diff --git a/generator/konfig-generator-api/src/main/resources/Java/libraries/okhttp-gson/pojo.mustache b/generator/konfig-generator-api/src/main/resources/Java/libraries/okhttp-gson/pojo.mustache index 2d67e19977..82f5af7aa6 100644 --- a/generator/konfig-generator-api/src/main/resources/Java/libraries/okhttp-gson/pojo.mustache +++ b/generator/konfig-generator-api/src/main/resources/Java/libraries/okhttp-gson/pojo.mustache @@ -615,7 +615,9 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); else if (entry.getValue() instanceof Character) obj.addProperty(entry.getKey(), (Character) entry.getValue()); - else { + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); } } diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/LICENSE b/generator/konfig-integration-tests/sdks/java-additional-null-property/LICENSE new file mode 100644 index 0000000000..6f78cb8b39 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/LICENSE @@ -0,0 +1,7 @@ +Copyright (c) 2024- Konfig, Inc. (https://konfigthis.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/README.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/README.md new file mode 100644 index 0000000000..6f4c038733 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/README.md @@ -0,0 +1,5 @@ +# konfig + +|Language|Version|Package Manager|README|Source| +|-|-|-|-|-| +|Java|5.0.30|[Maven Central](https://central.sonatype.com/artifact/com.konfigthis/snaptrade-java-sdk/5.0.30)|[README](https://github.com/passiv/snaptrade-sdks/tree/HEAD/sdks/java#readme)|[Source](https://github.com/passiv/snaptrade-sdks/tree/HEAD/sdks/java)| \ No newline at end of file diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/api.yaml b/generator/konfig-integration-tests/sdks/java-additional-null-property/api.yaml new file mode 100644 index 0000000000..70ec88b29f --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/api.yaml @@ -0,0 +1,4674 @@ +openapi: 3.0.0 +info: + description: Connect brokerage accounts to your app for live positions and trading + version: 1.0.0 + title: SnapTrade + termsOfService: N/A + contact: + email: api@snaptrade.com + x-konfig-ignore: + potential-incorrect-type: true + x-readme: + explorer-enabled: false +servers: + - description: SnapTrade Production API + url: https://api.snaptrade.com/api/v1 +security: + - PartnerSignature: [] + PartnerClientId: [] + PartnerTimestamp: [] +tags: + - name: API Status + description: Check whether the API is operational and verify timestamps. + - name: API Disclaimer + description: Endpoints related to terms of conditions of SnapTrade API use + - name: Custom Brokerage API Credentials + description: Allows SnapTrade partners to use their own brokerage API credentials + - name: Development Tools + description: Test and debug API authentication. + - name: Authentication + description: Register and authenticate users with SnapTrade. + - name: Connections + description: Retrieve and manage user connections. + - name: Account Information + description: Retrieve account information, such as positions, balances, etc. + - name: Transactions And Reporting + description: Retrieve information on account transactions, performance, + dividends, contributions, etc. + - name: Trading + description: Manage orders on user accounts + - name: Reference Data + description: Retrieve basic information for API use, such as supported + brokerages, exchanges, currencies, etc. + - name: Webhooks + description: + Reach out directly to SnapTrade to enable webhooks in order to be + notified when certain events occur. + - name: Options + description: + Endpoints to search for options prices and chains as well as place options trades if supported. +paths: + /: + get: + tags: + - API Status + summary: Get API Status + description: Check whether the API is operational and verify timestamps. + operationId: ApiStatus_check + security: [] + responses: + "200": + description: API is operational. + content: + application/json: + schema: + $ref: "#/components/schemas/Status" + default: + description: Unexpected error. + /snapTrade/listUsers: + get: + tags: + - Authentication + summary: List SnapTrade users + operationId: Authentication_listSnapTradeUsers + description: "Returns a list of users you've registered over the SnapTrade API." + responses: + "200": + description: Successfully retrieved a list of users + content: + application/json: + schema: + $ref: "#/components/schemas/UserList" + "400": + description: + Bad Request. Could be caused by various reasons. Error message is + provided in response + content: + application/json: + schema: + $ref: "#/components/schemas/400FailedRequestResponse" + "404": + description: Invalid SnapTrade Client ID provided in query + content: + application/json: + schema: + $ref: "#/components/schemas/404FailedRequestResponse" + "500": + description: Unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/500UnexpectedExceptionResponse" + /snapTrade/registerUser: + post: + tags: + - Authentication + summary: Create SnapTrade user + description: | + Registers a new SnapTrade user under your ClientID. A user secret will be automatically generated for you and must be properly stored in your database. + Most SnapTrade operations require a user ID and user secret to be passed as a parameter. + operationId: Authentication_registerSnapTradeUser + requestBody: + $ref: "#/components/requestBodies/RegisterUserRequestBody" + responses: + "200": + description: Successfully registered user + content: + application/json: + schema: + $ref: "#/components/schemas/UserIDandSecret" + "400": + description: + Bad Request. Could be caused by various reasons. Error message is + provided in response + content: + application/json: + schema: + $ref: "#/components/schemas/400FailedRequestResponse" + "404": + description: Invalid SnapTrade Client ID provided in query + content: + application/json: + schema: + $ref: "#/components/schemas/404FailedRequestResponse" + "500": + description: Unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/500UnexpectedExceptionResponse" + /snapTrade/deleteUser: + delete: + tags: + - Authentication + summary: + Delete SnapTrade user + operationId: Authentication_deleteSnapTradeUser + description: "Deletes a user you've registered over the SnapTrade API, and any data associated with them or their investment accounts." + parameters: + - in: query + required: true + name: userId + schema: + $ref: "#/components/schemas/UserID" + responses: + "200": + description: Delete successful + content: + application/json: + schema: + $ref: "#/components/schemas/DeleteUserResponse" + "400": + description: Bad Request + content: + application/json: + schema: + $ref: "#/components/schemas/400FailedRequestResponse" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: "#/components/schemas/403FailedRequestResponse" + "404": + description: Not Found + content: + application/json: + schema: + $ref: "#/components/schemas/404FailedRequestResponse" + "500": + description: Unexpected Error + /snapTrade/login: + post: + tags: + - Authentication + summary: Login user & generate connection link + operationId: Authentication_loginSnapTradeUser + description: Logs in a SnapTrade user and returns an authenticated connection portal URL for them to use to connect a brokerage account. + parameters: + - in: query + required: true + name: userId + schema: + $ref: "#/components/schemas/UserID" + - in: query + required: true + name: userSecret + schema: + $ref: "#/components/schemas/UserSecret" + requestBody: + $ref: "#/components/requestBodies/SnapTradeLoginUserRequestBody" + responses: + "200": + description: Login successful. Redirect user to provided URI in response + content: + application/json: + schema: + oneOf: + - $ref: "#/components/schemas/LoginRedirectURI" + - $ref: "#/components/schemas/encryptedResponse" + "400": + description: Bad Request + content: + application/json: + schema: + $ref: "#/components/schemas/400FailedRequestResponse" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: "#/components/schemas/403FailedRequestResponse" + "404": + description: Not Found + content: + application/json: + schema: + $ref: "#/components/schemas/404FailedRequestResponse" + "500": + description: Unexpected Error + /snapTrade/resetUserSecret: + post: + tags: + - Authentication + summary: Obtain a new user secret for a user + description: | + This API is used to rotate the secret for a SnapTrade user. You might use this if a userSecret + is compromised. Please note that if you call this endpoint and fail to save the new secret, you'll no longer be able to access any data for this user, and your only option will be to delete and recreate the user, then ask them to reconnect. + operationId: Authentication_resetSnapTradeUserSecret + requestBody: + $ref: "#/components/requestBodies/ResetUserSecretRequestBody" + responses: + "200": + description: New user secret is generated + content: + application/json: + schema: + $ref: "#/components/schemas/UserIDandSecret" + "400": + description: + Bad Request. Could be caused by various reasons. Error message is + provided in response + content: + application/json: + schema: + $ref: "#/components/schemas/400FailedRequestResponse" + "401": + description: Failed authenticaion. Wrong clientId, userId or userSecret provided + content: + application/json: + schema: + $ref: "#/components/schemas/401FailedRequestResponse" + "500": + description: Unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/500UnexpectedExceptionResponse" + /snapTrade/partners: + get: + tags: + - Reference Data + summary: Get metadata related to Snaptrade partner + description: Returns useful data related to the specified ClientID, including allowed brokerages and data access. + operationId: ReferenceData_getPartnerInfo + parameters: [] + responses: + "200": + description: + Successfully obtained encrypted JWT data. See description on how to + object JWT token + content: + application/json: + schema: + $ref: "#/components/schemas/PartnerData" + "400": + description: Bad Request + content: + application/json: + schema: + $ref: "#/components/schemas/400FailedRequestResponse" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: "#/components/schemas/401FailedRequestResponse" + "404": + description: Not Found + content: + application/json: + schema: + $ref: "#/components/schemas/404FailedRequestResponse" + "500": + description: Unexpected Error + /holdings: + get: + deprecated: true + tags: + - Account Information + summary: + List all accounts for the user, plus balances, positions, and orders for each + account. + description: | + **Deprecated, please use the account-specific holdings endpoint instead.** + + List all accounts for the user, plus balances, positions, and orders for each + account. + operationId: AccountInformation_getAllUserHoldings + parameters: + - in: query + required: true + name: userId + schema: + $ref: "#/components/schemas/UserID" + - in: query + required: true + name: userSecret + schema: + $ref: "#/components/schemas/UserSecret" + - in: query + required: false + name: brokerage_authorizations + description: + Optional. Comma seperated list of authorization IDs (only use if + filtering is needed on one or more authorizations). + schema: + type: string + format: uuid + example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + responses: + "200": + description: Returns list of accounts and holdings + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/AccountHoldings" + "400": + description: Bad Request + content: + application/json: + schema: + $ref: "#/components/schemas/400FailedRequestResponse" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: "#/components/schemas/403FailedRequestResponse" + "500": + description: Unexpected Error + /accounts/{accountId}/holdings: + get: + tags: + - Account Information + summary: List account holdings + description: | + Lists balances, positions, option positions, and recent orders for the specified account. The data returned is similar to the data returned over the more fine-grained [balances](/reference/Account%20Information/AccountInformation_getUserAccountBalance), [positions](/reference/Account%20Information/AccountInformation_getUserAccountPositions) and [orders](/reference/Account%20Information/AccountInformation_getUserAccountOrders) endpoints. __The finer-grained APIs are preferred. They are easier to work with, faster, and have better error handling than this coarse-grained API.__ + operationId: AccountInformation_getUserHoldings + parameters: + - in: path + name: accountId + required: true + schema: + $ref: "#/components/schemas/AccountID" + - in: query + required: true + name: userId + schema: + $ref: "#/components/schemas/UserID" + - in: query + required: true + name: userSecret + schema: + $ref: "#/components/schemas/UserSecret" + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/AccountHoldingsAccount" + "400": + description: Bad Request + content: + application/json: + schema: + $ref: "#/components/schemas/400FailedRequestResponse" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: "#/components/schemas/403FailedRequestResponse" + "500": + description: Unexpected Error + /accounts: + get: + tags: + - Account Information + summary: List accounts + description: Get a list of all Account objects for the authenticated SnapTrade user. + operationId: AccountInformation_listUserAccounts + parameters: + - in: query + required: true + name: userId + schema: + $ref: "#/components/schemas/UserID" + - in: query + required: true + name: userSecret + schema: + $ref: "#/components/schemas/UserSecret" + responses: + "200": + description: A list of all Account objects for the authenticated user. + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/Account" + default: + description: Unexpected error. + "/accounts/{accountId}": + get: + tags: + - Account Information + summary: Return details of a specific investment account + description: | + Returns an account object with details for the specified account, + including the total account market value. + operationId: AccountInformation_getUserAccountDetails + parameters: + - in: query + required: true + name: userId + schema: + $ref: "#/components/schemas/UserID" + - in: query + required: true + name: userSecret + schema: + $ref: "#/components/schemas/UserSecret" + - in: path + name: accountId + required: true + description: The ID of the account to get detail of. + schema: + type: string + format: uuid + example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + responses: + "200": + description: Details of a specific investment account + content: + application/json: + schema: + $ref: "#/components/schemas/Account" + default: + description: Unexpected error + put: + tags: + - Account Information + summary: Update details of an investment account + description: Updates various properties of a specified account. + operationId: AccountInformation_updateUserAccount + parameters: + - in: query + required: true + name: userId + schema: + $ref: "#/components/schemas/UserID" + - in: query + required: true + name: userSecret + schema: + $ref: "#/components/schemas/UserSecret" + - in: path + name: accountId + required: true + description: The ID of the account to update. + schema: + type: string + format: uuid + responses: + "200": + description: Successfully updated details of an investment account + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/Account" + default: + description: Unexpected error + /accounts/{accountId}/balances: + get: + tags: + - Account Information + summary: List account balances + operationId: AccountInformation_getUserAccountBalance + description: A list of account balances for the specified account (one per currency that the account holds). + parameters: + - in: query + required: true + name: userId + schema: + $ref: "#/components/schemas/UserID" + - in: query + required: true + name: userSecret + schema: + $ref: "#/components/schemas/UserSecret" + - in: path + name: accountId + required: true + description: The ID of the account to get balances. + schema: + type: string + format: uuid + example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + responses: + "200": + description: List of all balances in investment account + content: + "*/*": + schema: + type: array + items: + $ref: "#/components/schemas/Balance" + default: + description: Unexpected error + /accounts/{accountId}/positions: + get: + tags: + - Account Information + summary: List account positions + description: Returns a list of positions in the specified account. + operationId: AccountInformation_getUserAccountPositions + parameters: + - in: query + required: true + name: userId + schema: + $ref: "#/components/schemas/UserID" + - in: query + required: true + name: userSecret + schema: + $ref: "#/components/schemas/UserSecret" + - in: path + name: accountId + required: true + description: The ID of the account to get positions. + schema: + type: string + format: uuid + example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + responses: + "200": + description: List all positions in investment account + content: + "*/*": + schema: + type: array + items: + $ref: "#/components/schemas/Position" + default: + description: Unexpected error + /accounts/{accountId}/orders: + get: + tags: + - Account Information + summary: List account orders + operationId: AccountInformation_getUserAccountOrders + description: Fetch all recent orders from a user's account. + parameters: + - in: query + required: true + name: userId + schema: + $ref: "#/components/schemas/UserID" + - in: query + required: true + name: userSecret + schema: + $ref: "#/components/schemas/UserSecret" + - in: query + name: state + description: defaults value is set to "all" + schema: + type: string + enum: + - all + - open + - executed + - in: query + name: days + description: Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. + schema: + type: integer + format: int32 + minimum: 1 + example: 30 + - in: path + name: accountId + required: true + description: The ID of the account to get orders. + schema: + type: string + format: uuid + example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + responses: + "200": + description: List all orders in account + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/AccountOrderRecord" + "500": + description: Unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/500UnexpectedExceptionResponse" + "/accounts/{accountId}/quotes": + get: + tags: + - Trading + summary: Get symbol quotes + description: Returns quote(s) from the brokerage for the specified symbol(s). + operationId: Trading_getUserAccountQuotes + parameters: + - in: query + required: true + name: userId + schema: + $ref: "#/components/schemas/UserID" + - in: query + required: true + name: userSecret + schema: + $ref: "#/components/schemas/UserSecret" + - in: query + name: symbols + required: true + description: List of universal_symbol_id or tickers to get quotes for. + schema: + type: string + - in: query + name: use_ticker + description: Should be set to True if providing tickers. + schema: + type: boolean + - in: path + name: accountId + required: true + description: The ID of the account to get quotes. + schema: + type: string + format: uuid + example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + responses: + "200": + description: Returns quotes object with different prices + content: + application/json: + schema: + $ref: "#/components/schemas/SymbolsQuotes" + "500": + description: Unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/500UnexpectedExceptionResponse" + "/accounts/{accountId}/orders/cancel": + post: + tags: + - Trading + summary: Cancel open order in account + description: | + Sends a signal to the brokerage to cancel the specified order. + This will only work if the order has not yet been executed. + operationId: Trading_cancelUserAccountOrder + parameters: + - in: query + required: true + name: userId + schema: + $ref: "#/components/schemas/UserID" + - in: query + required: true + name: userSecret + schema: + $ref: "#/components/schemas/UserSecret" + - in: path + name: accountId + required: true + description: The ID of the account to cancel the order in. + schema: + type: string + format: uuid + example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + + requestBody: + $ref: '#/components/requestBodies/CancelOrderRequestBody' + + + responses: + "200": + description: Order Record of canceled order + content: + application/json: + schema: + $ref: "#/components/schemas/AccountOrderRecord" + "400": + description: + Unable to cancel open order. Please verify status in brokerage + account + content: + application/json: + schema: + $ref: "#/components/schemas/400FailedRequestResponse" + "500": + description: Unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/500UnexpectedExceptionResponse" + "/accounts/{accountId}/symbols": + post: + tags: + - Reference Data + summary: + Search for symbols available in an account + description: | + Returns a list of universal symbols that are supported by + the specificied account. Returned symbols are based on the + provided search string, matching on ticker and name. + operationId: ReferenceData_symbolSearchUserAccount + parameters: + - in: query + required: true + name: userId + schema: + $ref: "#/components/schemas/UserID" + - in: query + required: true + name: userSecret + schema: + $ref: "#/components/schemas/UserSecret" + - in: path + name: accountId + required: true + description: The ID of the account to search for symbols within. + schema: + type: string + format: uuid + example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/SymbolQuery" + responses: + "200": + description: + List of universal symbol supported by account based on substring + sent it + content: + "*/*": + schema: + type: array + items: + $ref: "#/components/schemas/UniversalSymbol" + default: + description: Unexpected error + "/accounts/{accountId}/options": + get: + tags: + - Options + summary: Get account option holdings + description: | + Returns a list of Options Positions. + operationId: Options_listOptionHoldings + parameters: + - in: query + required: true + name: userId + schema: + $ref: "#/components/schemas/UserID" + - in: query + required: true + name: userSecret + schema: + $ref: "#/components/schemas/UserSecret" + - in: path + name: accountId + required: true + description: The ID of the account to fetch options holdings for. + schema: + type: string + format: uuid + responses: + "200": + description: The option holdings in the account + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/OptionsPosition" + "500": + description: Unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/500UnexpectedExceptionResponse" + "/accounts/{accountId}/optionsChain": + get: + tags: + - Options + summary: Get the options chain for a symbol + description: Returns the option chain for the specified symbol in the specified account. + operationId: Options_getOptionsChain + parameters: + - in: query + required: true + name: userId + schema: + $ref: "#/components/schemas/UserID" + - in: query + required: true + name: userSecret + schema: + $ref: "#/components/schemas/UserSecret" + - in: path + name: accountId + required: true + description: The ID of the account to get the options chain from. + schema: + type: string + format: uuid + - in: query + name: symbol + required: true + description: Universal symbol ID if symbol + schema: + type: string + format: uuid + responses: + "200": + description: List of all Options available for the brokerage symbol + content: + application/json: + schema: + $ref: "#/components/schemas/OptionChain" + "500": + description: Unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/500UnexpectedExceptionResponse" + "/accounts/{accountId}/optionStrategy": + post: + tags: + - Options + summary: Create options strategy + description: | + Creates an option strategy object that will be used to place an option strategy order. + operationId: Options_getOptionStrategy + parameters: + - in: query + required: true + name: userId + schema: + $ref: "#/components/schemas/UserID" + - in: query + required: true + name: userSecret + schema: + $ref: "#/components/schemas/UserSecret" + - in: path + name: accountId + required: true + description: The ID of the account to create the option strategy object in. + schema: + type: string + format: uuid + requestBody: + $ref: "#/components/requestBodies/OptionStrategyRequestBody" + + responses: + "200": + description: Order Quotes + content: + application/json: + schema: + $ref: "#/components/schemas/StrategyQuotes" + "500": + description: Unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/500UnexpectedExceptionResponse" + + + /accounts/{accountId}/optionStrategy/{optionStrategyId}: + get: + tags: + - Options + summary: Get options strategy quotes + description: | + Returns a Strategy Quotes object which has latest market data of the specified option strategy. + operationId: Options_getOptionsStrategyQuote + parameters: + - in: query + required: true + name: userId + schema: + $ref: "#/components/schemas/UserID" + - in: query + required: true + name: userSecret + schema: + $ref: "#/components/schemas/UserSecret" + - in: path + name: accountId + required: true + description: The ID of the account the strategy will be placed in. + schema: + type: string + format: uuid + - in: path + required: true + name: optionStrategyId + description: Option strategy id obtained from response when creating option strategy object + schema: + $ref: "#/components/schemas/Id" + responses: + "200": + description: Order Quotes + content: + application/json: + schema: + $ref: "#/components/schemas/StrategyQuotes" + "500": + description: Unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/500UnexpectedExceptionResponse" + + "/accounts/{accountId}/optionStrategy/{optionStrategyId}/execute": + post: + tags: + - Options + summary: Place an option strategy order + description: Places the option strategy order and returns the order record received from the brokerage. + operationId: Options_placeOptionStrategy + parameters: + - in: query + required: true + name: userId + schema: + $ref: "#/components/schemas/UserID" + - in: query + required: true + name: userSecret + schema: + $ref: "#/components/schemas/UserSecret" + - in: path + name: accountId + required: true + description: The ID of the account to execute the strategy in. + schema: + $ref: "#/components/schemas/Id" + - in: path + name: optionStrategyId + required: true + description: Option strategy id obtained from response when creating option strategy object + schema: + $ref: "#/components/schemas/Id" + requestBody: + $ref: "#/components/requestBodies/OrderStrategyExecuteBody" + + responses: + "200": + description: Status of strategy order placed + content: + application/json: + schema: + $ref: "#/components/schemas/StrategyOrderRecord" + "500": + description: Unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/500UnexpectedExceptionResponse" + "/authorizations": + get: + tags: + - Connections + summary: List all brokerage authorizations for the User + description: Returns a list of Brokerage Authorization objects for the user + operationId: Connections_listBrokerageAuthorizations + parameters: + - in: query + required: true + name: userId + schema: + $ref: "#/components/schemas/UserID" + - in: query + required: true + name: userSecret + schema: + $ref: "#/components/schemas/UserSecret" + responses: + "200": + description: A list of all Authorization objects for the authenticated user. + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/BrokerageAuthorization" + default: + description: Unexpected error. + "/authorizations/{authorizationId}": + get: + tags: + - Connections + summary: Get brokerage authorization details + description: Returns a single brokerage authorization object for the specified ID. + operationId: Connections_detailBrokerageAuthorization + parameters: + - in: path + name: authorizationId + required: true + description: The ID of a brokerage authorization object. + schema: + $ref: "#/components/schemas/Id" + - in: query + required: true + name: userId + schema: + $ref: "#/components/schemas/UserID" + - in: query + required: true + name: userSecret + schema: + $ref: "#/components/schemas/UserSecret" + responses: + "200": + description: Authorization object for the authenticated user. + content: + application/json: + schema: + $ref: "#/components/schemas/BrokerageAuthorization" + default: + description: Unexpected error. + delete: + tags: + - Connections + summary: Delete brokerage authorization + description: Deletes a specified brokerage authorization given by the ID. + operationId: Connections_removeBrokerageAuthorization + parameters: + - in: path + name: authorizationId + required: true + description: The ID of the Authorization to delete. + schema: + $ref: "#/components/schemas/Id" + - in: query + required: true + name: userId + schema: + $ref: "#/components/schemas/UserID" + - in: query + required: true + name: userSecret + schema: + $ref: "#/components/schemas/UserSecret" + responses: + "204": + description: Brokerage authorization object has been successfully deleted + "400": + description: The specified authorizationId is invalid (not a UUID string). + "404": + description: The specified authorizationId was not found. + default: + description: Unexpected error. + "/authorizations/{authorizationId}/refresh": + post: + tags: + - Connections + summary: Refresh holdings for a connection + description: Trigger a holdings update for all accounts under this authorization. Updates will be queued asynchronously. ACCOUNT_HOLDINGS_UPDATED webhook will be sent once the sync completes. Please contact support for access as this endpoint is not enabled by default + operationId: Connections_refreshBrokerageAuthorization + parameters: + - in: path + name: authorizationId + required: true + description: The ID of a brokerage authorization object. + schema: + $ref: "#/components/schemas/Id" + - in: query + required: true + name: userId + schema: + $ref: "#/components/schemas/UserID" + - in: query + required: true + name: userSecret + schema: + $ref: "#/components/schemas/UserSecret" + responses: + "200": + description: Confirmation that the syncs have been scheduled + content: + application/json: + schema: + $ref: "#/components/schemas/BrokerageAuthorizationRefreshConfirmation" + "401": + description: Unauthorized, invalid credentials for this resource + content: + application/json: + schema: + $ref: "#/components/schemas/401FailedRequestResponse" + "402": + description: Unable to sync with brokerage account because the connection is disabled. + content: + application/json: + schema: + $ref: "#/components/schemas/402BrokerageAuthDisabledResponse" + "403": + description: Customer or user does not have access to this feature + content: + application/json: + schema: + $ref: "#/components/schemas/403FeatureNotEnabledResponse" + "404": + description: The requested resource does not exist. + content: + application/json: + schema: + $ref: "#/components/schemas/404FailedRequestResponse" + "/authorizations/{authorizationId}/disable": + post: + tags: + - Connections + summary: Manually disable a connection for testing + description: Manually disable a connection. This should only be used for testing a reconnect flow, and never used on production connections. + Will trigger a disconnect as if it happened naturally, and send a CONNECTION_BROKEN webhook for the connection. Please contact us in order to use this endpoint as it is disabled by default. + operationId: Connections_disableBrokerageAuthorization + parameters: + - in: path + name: authorizationId + required: true + description: The ID of a brokerage authorization object. + schema: + $ref: "#/components/schemas/Id" + - in: query + required: true + name: userId + schema: + $ref: "#/components/schemas/UserID" + - in: query + required: true + name: userSecret + schema: + $ref: "#/components/schemas/UserSecret" + responses: + "200": + description: Confirmation that the connection has been disabled + content: + application/json: + schema: + $ref: "#/components/schemas/BrokerageAuthorizationDisabledConfirmation" + "401": + description: Unauthorized, invalid credentials for this resource + content: + application/json: + schema: + $ref: "#/components/schemas/401FailedRequestResponse" + "402": + description: Unable to sync with brokerage account because the connection is disabled. + content: + application/json: + schema: + $ref: "#/components/schemas/402BrokerageAuthAlreadyDisabledException" + "403": + description: Customer or user does not have access to this feature + content: + application/json: + schema: + $ref: "#/components/schemas/403FeatureNotEnabledResponse" + "404": + description: The requested resource does not exist. + content: + application/json: + schema: + $ref: "#/components/schemas/404FailedRequestResponse" + + "/sessionEvents": + get: + tags: + - Connections + summary: Get all session events for a user + description: Returns a list of session events associated with a user. + operationId: Connections_sessionEvents + parameters: + - in: query + required: true + name: PartnerClientId + schema: + $ref: "#/components/schemas/ClientID" + - in: query + required: false + name: userId + description: Optional comma seperated list of user IDs used to filter the + request on specific users + schema: + $ref: "#/components/schemas/AccountIDs" + - in: query + required: false + name: sessionId + description: Optional comma seperated list of session IDs used to filter the + request on specific users + schema: + $ref: "#/components/schemas/AccountIDs" + responses: + "200": + description: A list of all Session Events for the Partner. + content: + application/json: + schema: + type: array + items: + anyOf: + - $ref: "#/components/schemas/SessionEvent" + default: + description: Unexpected error. + "/brokerages": + get: + tags: + - Reference Data + summary: Get brokerages + description: Returns a list of all defined Brokerage objects. + operationId: ReferenceData_listAllBrokerages + parameters: [] + responses: + "200": + description: A list of all defined Brokerage objects. + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/Brokerage" + default: + description: Unexpected error. + "/brokerageAuthorizationTypes": + get: + tags: + - Reference Data + summary: Get all brokerage authorization types + description: Returns a list of all defined Brokerage authorization Type objects. + operationId: ReferenceData_listAllBrokerageAuthorizationType + parameters: + - in: query + required: false + name: brokerage + schema: + type: string + example: QUESTRADE,ALPACA + description: Comma separated value of brokerage slugs + responses: + "200": + description: A list of all defined Brokerage Authorization Type objects. + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/BrokerageAuthorizationTypeReadOnly" + default: + description: Unexpected error. + /currencies: + get: + tags: + - Reference Data + summary: Get currencies + description: Returns a list of all defined Currency objects. + operationId: ReferenceData_listAllCurrencies + parameters: [] + responses: + "200": + description: A list of all currencies. + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/Currency" + default: + description: Unexpected error. + /currencies/rates: + get: + tags: + - Reference Data + summary: Get currency exchange rates + description: Returns a list of all Exchange Rate Pairs for all supported Currencies. + operationId: ReferenceData_listAllCurrenciesRates + parameters: [] + responses: + "200": + description: A list of all exchange rates pairs for supported currencies + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/ExchangeRatePairs" + /currencies/rates/{currencyPair}: + get: + tags: + - Reference Data + summary: Get exchange rate of a currency pair + description: Returns an Exchange Rate Pair object for the specified Currency Pair. + operationId: ReferenceData_getCurrencyExchangeRatePair + parameters: + - in: path + name: currencyPair + required: true + description: A currency pair based on currency code for example, {CAD-USD} + schema: + type: string + responses: + "200": + description: A list of all exchange rates pairs for supported currencies + content: + application/json: + schema: + $ref: "#/components/schemas/ExchangeRatePairs" + /exchanges: + get: + tags: + - Reference Data + summary: Get exchanges + description: Returns a list of all supported Exchanges. + operationId: ReferenceData_getStockExchanges + parameters: [] + responses: + "200": + description: A list of all supported stock exchanges + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/Exchange" + /securityTypes: + get: + tags: + - Reference Data + summary: List of all security types + operationId: ReferenceData_getSecurityTypes + description: List security types available on SnapTrade. + parameters: [] + responses: + "200": + description: A list of all defined Security Type objects. + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/SecurityType" + default: + description: Unexpected error. + /symbols: + post: + tags: + - Reference Data + summary: Search for symbols + description: | + Returns a list of Universal Symbol objects that match a defined string. + + Matches on ticker or name. + operationId: ReferenceData_getSymbols + parameters: [] + responses: + "200": + description: A list of UniversalSymbol objects which match the specified substring + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/UniversalSymbol" + default: + description: Unexpected error. + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/SymbolQuery" + /symbols/{query}: + get: + tags: + - Reference Data + summary: Get details of a symbol + description: Returns the Universal Symbol object specified by the ticker or the universal_symbol_id. + operationId: ReferenceData_getSymbolsByTicker + parameters: + - in: path + name: query + required: true + description: The ticker or universal_symbol_id of the UniversalSymbol to get. + schema: + type: string + responses: + "200": + description: Successfully gets a symbol + content: + "*/*": + schema: + $ref: "#/components/schemas/UniversalSymbol" + "404": + description: No symbol with the specified ticker found. + default: + description: Unexpected error + /trade/place: + post: + tags: + - Trading + summary: Place a trade with NO validation. + description: Places a specified trade in the specified account. + operationId: Trading_placeForceOrder + parameters: + - in: query + required: true + name: userId + schema: + $ref: "#/components/schemas/UserID" + - in: query + required: true + name: userSecret + schema: + $ref: "#/components/schemas/UserSecret" + + responses: + "200": + description: Trade sucessfully placed + content: + application/json: + schema: + $ref: "#/components/schemas/AccountOrderRecord" + "400": + description: Trade could not be placed + content: + application/json: + schema: + $ref: "#/components/schemas/400FailedRequestResponse" + "403": + description: User does not have permissions to place trades + content: + application/json: + schema: + $ref: "#/components/schemas/403FailedRequestResponse" + "500": + description: Unexpected Error + requestBody: + $ref: "#/components/requestBodies/ManualTradeFormRequestBody" + /trade/impact: + post: + tags: + - Trading + summary: Check the impact of a trade on an account + description: Return the trade object and it's impact on the account for the specified order. + operationId: Trading_getOrderImpact + parameters: + - in: query + required: true + name: userId + schema: + $ref: "#/components/schemas/UserID" + - in: query + required: true + name: userSecret + schema: + $ref: "#/components/schemas/UserSecret" + responses: + "200": + description: Return trade object and it's impact on the account + content: + application/json: + schema: + $ref: "#/components/schemas/ManualTradeAndImpact" + "400": + description: Missing or wrong data format provided in request body + content: + application/json: + schema: + $ref: "#/components/schemas/400FailedRequestResponse" + "403": + description: User does not have permissions to place trades + content: + application/json: + schema: + $ref: "#/components/schemas/403FailedRequestResponse" + "500": + description: Unexpected Error + requestBody: + $ref: "#/components/requestBodies/ManualTradeFormRequestBody" + /trade/{tradeId}: + post: + tags: + - Trading + summary: Place order + description: | + Places the specified trade object. This places the order in the account and + returns the status of the order from the brokerage. + operationId: Trading_placeOrder + parameters: + - in: path + name: tradeId + required: true + description: The ID of trade object obtained from trade/impact endpoint + schema: + type: string + format: uuid + - in: query + required: true + name: userId + schema: + $ref: "#/components/schemas/UserID" + - in: query + required: true + name: userSecret + schema: + $ref: "#/components/schemas/UserSecret" + responses: + "200": + description: Status of order placed + content: + application/json: + schema: + $ref: "#/components/schemas/AccountOrderRecord" + "400": + description: Failed to submit order to broker + content: + application/json: + schema: + $ref: "#/components/schemas/400FailedRequestResponse" + "500": + description: Unexpected Error + requestBody: + $ref: "#/components/requestBodies/ValidatedTradeRequestBody" + /activities: + get: + tags: + - Transactions And Reporting + summary: Get transaction history for a user + operationId: TransactionsAndReporting_getActivities + description: + Returns activities (transactions) for a user. Specifying start and + end date is highly recommended for better performance + parameters: + - in: query + required: false + name: startDate + schema: + $ref: "#/components/schemas/ReportingDate" + - in: query + required: false + name: endDate + schema: + $ref: "#/components/schemas/ReportingDate" + - in: query + required: false + name: accounts + description: + Optional comma seperated list of account IDs used to filter the + request on specific accounts + schema: + $ref: "#/components/schemas/AccountIDs" + - in: query + required: false + name: brokerageAuthorizations + description: + Optional comma seperated list of brokerage authorization IDs used to filter the + request on only accounts that belong to those authorizations + schema: + $ref: "#/components/schemas/BrokerageAuthIDs" + - in: query + required: false + name: type + description: + Optional comma seperated list of types to filter activities by. This is not an exhaustive list, if we fail to match to these types, we will return the raw description from the brokerage. Potential values include + - DIVIDEND + - BUY + - SELL + - CONTRIBUTION + - WITHDRAWAL + - EXTERNAL_ASSET_TRANSFER_IN + - EXTERNAL_ASSET_TRANSFER_OUT + - INTERNAL_CASH_TRANSFER_IN + - INTERNAL_CASH_TRANSFER_OUT + - INTERNAL_ASSET_TRANSFER_IN + - INTERNAL_ASSET_TRANSFER_OUT + - INTEREST + - REBATE + - GOV_GRANT + - TAX + - FEE + - REI + - FXT + schema: + type: string + example: DIVIDEND + - in: query + required: true + name: userId + schema: + $ref: "#/components/schemas/UserID" + - in: query + required: true + name: userSecret + schema: + $ref: "#/components/schemas/UserSecret" + responses: + "200": + description: Successfully retrieved transaction history + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/UniversalActivity" + default: + description: Unexpected error + /performance/custom: + get: + deprecated: true + tags: + - Transactions And Reporting + summary: Get performance information for a specific timeframe + operationId: TransactionsAndReporting_getReportingCustomRange + description: + Returns performance information (contributions, dividends, rate of + return, etc) for a specific timeframe. Please note that Total Equity Timeframe and Rate of Returns are experimental features. Please contact support@snaptrade.com if you notice any inconsistencies. + parameters: + - in: query + required: true + name: startDate + schema: + $ref: "#/components/schemas/ReportingDate" + - in: query + required: true + name: endDate + schema: + $ref: "#/components/schemas/ReportingDate" + - in: query + required: false + name: accounts + description: + Optional comma seperated list of account IDs used to filter the + request on specific accounts + schema: + $ref: "#/components/schemas/AccountIDs" + - in: query + required: false + name: detailed + description: + Optional, increases frequency of data points for the total value + and contribution charts if set to true + schema: + type: boolean + example: true + - in: query + required: false + name: frequency + description: + Optional frequency for the rate of return chart (defaults to + monthly). Possible values are daily, weekly, monthly, quarterly, + yearly. + schema: + $ref: "#/components/schemas/ReportingFrequency" + - in: query + required: true + name: userId + schema: + $ref: "#/components/schemas/UserID" + - in: query + required: true + name: userSecret + schema: + $ref: "#/components/schemas/UserSecret" + responses: + "200": + description: Successfully retrieved performance data + content: + application/json: + schema: + $ref: "#/components/schemas/PerformanceCustom" + default: + description: Unexpected error + /connectionAdded: + post: + tags: + - Webhooks + operationId: Webhooks_connectionAdded + description: A webhook that is sent whenever a new connection is added. + requestBody: + description: Information about a new connection in the system + content: + application/json: + schema: + $ref: "#/components/schemas/WebhookBase" + responses: + "200": + description: Return a 200 status to indicate that the connection was successful + "201": + description: Return a 201 status to indicate that the connection was successful + /connectionDeleted: + post: + tags: + - Webhooks + operationId: Webhooks_connectionDeleted + description: A webhook that is sent whenever an existing connection is deleted. + requestBody: + description: Information about the deleted connection + content: + application/json: + schema: + $ref: "#/components/schemas/WebhookBase" + responses: + "200": + description: + Return a 200 status to indicate that the connection was deleted + successfully + "201": + description: Return a 201 status to indicate that the connection was deleted + /userRegistered: + post: + tags: + - Webhooks + operationId: Webhooks_userRegistered + description: A webhook that is sent whenever a user is newly registered. + requestBody: + description: Information about the newly registered user + content: + application/json: + schema: + $ref: "#/components/schemas/WebhookBase" + responses: + "200": + description: + Return a 200 status to indicate that the user was registered + successfully + "201": + description: Return a 201 status to indicate that user was registered + successfully + /userDeleted: + post: + tags: + - Webhooks + operationId: Webhooks_userDeleted + description: A webhook that is sent whenever an existing user is deleted. + requestBody: + description: Information about the deleted user + content: + application/json: + schema: + $ref: "#/components/schemas/WebhookBase" + responses: + "200": + description: Return a 200 status to indicate that the user was deleted + successfully + "201": + description: Return a 201 status to indicate that the connection was successful + /accountAdded: + post: + tags: + - Webhooks + operationId: Webhooks_accountAdded + description: A webhook that is sent whenever a new account is added to an existing brokerage authorization. + requestBody: + description: Information about the newly added account + content: + application/json: + schema: + $ref: "#/components/schemas/WebhookBase" + responses: + "200": + description: + Return a 200 status to indicate that the account was added + successfully + "201": + description: Return a 201 status to indicate that the account was added + successfully + /accountDeleted: + post: + tags: + - Webhooks + operationId: Webhooks_accountDeleted + description: A webhook that is sent whenever an existing account under a brokerage authorization is deleted. + requestBody: + description: Information about the deleted account + content: + application/json: + schema: + $ref: "#/components/schemas/WebhookBase" + responses: + "200": + description: + Return a 200 status to indicate that the account was deleted + successfully + "201": + description: Return a 201 status to indicate that the account was deleted + successfully + /transactionsUpdated: + post: + tags: + - Webhooks + operationId: Webhooks_updatedTransactions + description: A webhook that is sent whenever transactions have been updated for an account. + requestBody: + description: Information about the account for which transactions have been updated + content: + application/json: + schema: + $ref: "#/components/schemas/WebhookBase" + responses: + "200": + description: Return a 200 status to indicate that the update was successful + "201": + description: Return a 201 status to indicate the update was successful +components: + securitySchemes: + PartnerSignature: + type: apiKey + in: header + name: Signature + PartnerClientId: + type: apiKey + in: query + name: clientId + PartnerTimestamp: + type: apiKey + in: query + name: timestamp + requestBodies: + MockSignatureRequestBody: + description: Request body to signed. Include it under "content" + content: + application/json: + schema: + type: object + example: + userId: snaptrade-user-123 + userSecret: CHRIS.P.BACON + RegisterUserRequestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/SnapTradeRegisterUserRequestBody" + ResetUserSecretRequestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/UserIDandSecret" + SnapTradeLoginUserRequestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/SnapTradeLoginUserRequestBody" + LoginRequestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/UserIDandSecret" + DeleteUserRequestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/UserIDandSecret" + RedeemTokenRequestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/RedirectTokenandPin" + PortfolioGroup: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/PortfolioGroup" + TargetAsset: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/TargetAsset" + ManualTradeFormRequestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/ManualTradeForm" + ValidatedTradeRequestBody: + required: false + content: + application/json: + schema: + $ref: "#/components/schemas/ValidatedTradeBody" + CancelOrderRequestBody: + description: The Order ID to be canceled + required: true + content: + application/json: + schema: + type: object + properties: + brokerage_order_id: + $ref: '#/components/schemas/Id' + + + + CreateSnapTradeParterAPICredentialsRequestBody: + required: true + content: + application/json: + schema: + type: object + properties: + brokerageAuthorizationTypeId: + description: + Brokerage Authorization Type ID from BrokerageAuthorizationType + object + brokerageAPIClientId: + description: API Client ID from brokerage when registering app + brokerageAPIClientSecret: + description: API Client Secret from brokerage when registering app + redirectURI: + description: Redirect uri from brokerage when registering app + + OptionStrategyRequestBody: + required: true + content: + application/json: + schema: + type: object + required: ["underlying_symbol_id", "legs", "strategy_type"] + properties: + underlying_symbol_id: + $ref: "#/components/schemas/Id" + legs: + type: array + items: + $ref: "#/components/schemas/OptionLeg" + strategy_type: + type: string + enum: + - CUSTOM + + OrderStrategyExecuteBody: + required: true + content: + application/json: + schema: + type: object + required: ["order_type", "time_in_force"] + properties: + order_type: + $ref: "#/components/schemas/OrderTypeStrict" + time_in_force: + $ref: "#/components/schemas/TimeInForceStrict" + price: + $ref: "#/components/schemas/Price" + + SnapTradeAPIDisclaimerAcceptRequestBody: + required: true + content: + application/json: + schema: + type: object + properties: + accepted: + type: boolean + description: + A boolean that indicates whether this user has accepted the + disclaimer or not. + schemas: + 400FailedRequestResponse: + description: Example for failed request response + type: object + properties: + default_detail: + example: Unable to verify data sent + default_code: + example: 1076 + 401FailedRequestResponse: + description: Example for failed request response + type: object + properties: + default_detail: + example: Unable to verify signature sent + default_code: + example: 1076 + 402BrokerageAuthDisabledResponse: + description: Cannot perform action because connection is disabled + type: object + properties: + detail: + example: Unable to sync with brokerage account because the connection is disabled. + code: + example: 3003 + 402BrokerageAuthAlreadyDisabledException: + description: This connection is already disabled. + type: object + properties: + detail: + example: This connection is already disabled. + code: + example: 3011 + 403FailedRequestResponse: + description: Example for failed request response + type: object + properties: + default_detail: + example: User does not have permission to access this resource + default_code: + example: 1066 + 403FeatureNotEnabledResponse: + description: Example for failed request response + type: object + properties: + detail: + example: Feature is not enabled for this customer or this connection + default_code: + example: 1141 + 404FailedRequestResponse: + description: Example for failed request response + type: object + properties: + default_detail: + example: The requested resource does not exist. + default_code: + example: 1011 + 500UnexpectedExceptionResponse: + description: Example for a response that failed for unexpected reasons + type: object + properties: + detail: + example: Encountered an unexpected exception. + status_code: + example: 500 + code: + example: 1000 + CashRestriction: + description: + Cash restriction rules that apply to this account when undergoing + portfolio rebalance calculations. + type: object + properties: + id: + $ref: "#/components/schemas/Id" + account: + $ref: "#/components/schemas/Id" + currency: + $ref: "#/components/schemas/Id" + type: + type: string + enum: + - ALLOCATE_MAX + - RETAIN_MIN + amount: + type: number + example: 100 + AccountSyncStatus: + description: Status of account + properties: + transactions: + $ref: "#/components/schemas/TransactionsStatus" + holdings: + $ref: "#/components/schemas/HoldingsStatus" + TransactionsStatus: + description: Status of account transaction sync + properties: + initial_sync_completed: + type: boolean + last_successful_sync: + $ref: "#/components/schemas/SyncStatusDate" + first_transaction_date: + $ref: "#/components/schemas/SyncStatusDate" + HoldingsStatus: + description: Status of account holdings sync + properties: + initial_sync_completed: + type: boolean + last_successful_sync: + $ref: "#/components/schemas/HoldingsSyncStatusDate" + AccountBalance: + description: Contains balance related information for the account. + properties: + total: + description: Total value of this account (includes cash, equity, fixed income, etc) + nullable: true + allOf: + - $ref: "#/components/schemas/Amount" + Amount: + description: Total value of the account, as reported by the brokerage + properties: + amount: + type: number + description: Total value denominated in the currency of the `currency` field. + example: 15363.23 + currency: + type: string + description: The ISO-4217 currency code for the amount. + example: USD + Account: + description: SnapTradeUser Investment Account + type: object + properties: + id: + $ref: "#/components/schemas/Id" + brokerage_authorization: + $ref: "#/components/schemas/Id" + portfolio_group: + $ref: "#/components/schemas/Id" + name: + type: string + example: Registered Retirement Savings Account + number: + type: string + example: Q6542138443 + institution_name: + type: string + example: Alpaca + created_date: + type: string + example: 2021-06-04T16:26:46.523334Z + meta: + type: object + example: + type: Margin + status: ACTIVE + institution_name: Alpaca + cash_restrictions: + type: array + items: + $ref: "#/components/schemas/CashRestriction" + sync_status: + $ref: "#/components/schemas/AccountSyncStatus" + balance: + $ref: "#/components/schemas/AccountBalance" + AccountSimple: + description: SnapTradeUser Investment Account + type: object + properties: + id: + $ref: "#/components/schemas/Id" + name: + type: string + example: Registered Retirement Savings Account + number: + type: string + example: Q6542138443 + sync_status: + $ref: "#/components/schemas/AccountSyncStatus" + AccountID: + description: Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade. + type: string + format: uuid + example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + AccountIDs: + description: Comma seperated list of account IDs + type: string + example: 917c8734-8470-4a3e-a18f-57c3f2ee6631,65e839a3-9103-4cfb-9b72-2071ef80c5f2 + BrokerageAuthID: + description: Unique identifier for the connection (brokerage authorization). This is the UUID used to reference the connection in SnapTrade. + type: string + format: uuid + example: 87b24961-b51e-4db8-9226-f198f6518a89 + BrokerageAuthIDs: + description: Comma seperated list of brokerage authorization IDs + type: string + example: 917c8734-8470-4a3e-a18f-57c3f2ee6631,65e839a3-9103-4cfb-9b72-2071ef80c5f2 + AccountHoldings: + description: Account Holdings + type: object + properties: + account: + $ref: "#/components/schemas/SnapTradeHoldingsAccount" + balances: + type: array + nullable: true + items: + $ref: "#/components/schemas/Balance" + positions: + type: array + nullable: true + items: + $ref: "#/components/schemas/Position" + total_value: + $ref: "#/components/schemas/SnapTradeHoldingsTotalValue" + AccountHoldingsAccount: + description: A wrapper object containing holdings information for a single account + type: object + properties: + account: + # FIXME - This should be a reference to the Account object + $ref: "#/components/schemas/SnapTradeHoldingsAccountAccountId" + balances: + type: array + nullable: true + description: List of balances for the account. Each element of the list has a distinct currency. Some brokerages like Questrade [allows holding multiple currencies in the same account](https://www.questrade.com/learning/questrade-basics/balances-and-reports/understanding-your-account-balances). + items: + $ref: "#/components/schemas/Balance" + positions: + type: array + nullable: true + description: List of stock/ETF/crypto/mutual fund positions in the account. + items: + $ref: "#/components/schemas/Position" + option_positions: + type: array + nullable: true + description: List of option positions in the account. + items: + $ref: "#/components/schemas/OptionsPosition" + orders: + type: array + nullable: true + description: List of recent orders in the account, including both pending and executed orders. + items: + $ref: "#/components/schemas/AccountOrderRecord" + total_value: + $ref: "#/components/schemas/SnapTradeHoldingsTotalValue" + AccountOrderRecord: + description: Record of order in brokerageaccount + type: object + properties: + brokerage_order_id: + description: Order id returned by brokerage + type: string + status: + $ref: "#/components/schemas/AccountOrderRecordStatus" + symbol: + $ref: "#/components/schemas/Id" + universal_symbol: + $ref: "#/components/schemas/UniversalSymbol" + option_symbol: + $ref: "#/components/schemas/OptionsSymbol" + action: + $ref: "#/components/schemas/Action" + total_quantity: + nullable: true + allOf: + - $ref: "#/components/schemas/Units" + open_quantity: + $ref: "#/components/schemas/OpenUnits" + canceled_quantity: + $ref: "#/components/schemas/CancelledUnits" + filled_quantity: + $ref: "#/components/schemas/FilledUnits" + execution_price: + $ref: "#/components/schemas/Price" + limit_price: + $ref: "#/components/schemas/Price" + stop_price: + $ref: "#/components/schemas/StopPrice" + order_type: + $ref: "#/components/schemas/OrderType" + time_in_force: + $ref: "#/components/schemas/TimeInForce" + time_placed: + $ref: "#/components/schemas/Time" + time_updated: + nullable: true + allOf: + - $ref: "#/components/schemas/Time" + time_executed: + nullable: true + allOf: + - $ref: "#/components/schemas/Time" + expiry_date: + $ref: "#/components/schemas/Time" + AccountOrderRecordStatus: + type: string + enum: + - NONE + - PENDING + - ACCEPTED + - FAILED + - REJECTED + - CANCELED + - PARTIAL_CANCELED + - CANCEL_PENDING + - EXECUTED + - PARTIAL + - REPLACE_PENDING + - REPLACED + - STOPPED + - SUSPENDED + - EXPIRED + - QUEUED + - TRIGGERED + - ACTIVATED + - PENDING_RISK_REVIEW + - CONTINGENT_ORDER + + OptionsPosition: + description: Describes a single option position in an account. + type: object + properties: + symbol: + $ref: "#/components/schemas/OptionBrokerageSymbol" + price: + type: number + example: 113.15 + description: Last known market price for the option contract. The freshness of this price depends on the brokerage. Some brokerages provide real-time prices, while others provide delayed prices. It is recommended that you rely on your own third-party market data provider for most up to date prices. + nullable: true + units: + type: number + description: The number of contracts for this option position. + example: 10 + currency: + nullable: true + allOf: + - $ref: "#/components/schemas/Currency" + average_purchase_price: + type: number + nullable: true + example: 108.3353 + description: Cost basis _per contract_ of this option position. To get the cost basis _per share_, divide this value by the number of shares per contract (usually 100). + StrategyImpact: + description: The strategy impact + type: object + properties: + estimatedCommissions: + type: number + example: 11.95 + buyingPowerEffect: + type: number + example: -156.3435 + buyingPowerResult: + type: number + example: 8800.0882 + maintExcessEffect: + type: number + example: -46.95 + maintExcessResult: + type: number + example: 2642.669129 + tradeValueCalculation: + type: string + example: 1 x 0.07 x 100 + 1 x 0.28 x 100 = DR 35.00 CAD + legs: + type: array + items: + type: object + properties: + legId: + type: integer + format: int32 + example: 0 + symbol: + type: string + example: AC21Oct22C30.00.MX + symbolId: + type: integer + format: int32 + example: 41790511 + legRatioQuantity: + type: integer + format: int32 + example: 1 + side: + type: string + example: BTO + avgExecPrice: + type: string + format: nullable + lastExecPrice: + type: string + format: nullable + side: + type: string + example: Buy + effect: + type: string + example: Debit + price: + type: number + example: 0.35 + strategy: + type: string + example: Strangle + StrategyOrderQuotes: + description: The quotes for the strategy requested + StrategyOrderPlace: + description: The reponse for a correctly placed order + type: object + properties: + orderId: + type: integer + format: int32 + example: 1069605761 + orders: + type: array + items: + type: object + properties: + id: + type: integer + format: int32 + example: 1069605761 + symbol: + type: string + example: AC.TO + symbolId: + type: integer + format: int32 + example: 7960447 + totalQuantity: + type: integer + format: int32 + example: 1 + openQuantity: + type: integer + format: int32 + example: 1 + filledQuantity: + type: integer + format: int32 + example: 0 + canceledQuantity: + type: integer + format: int32 + example: 0 + side: + type: string + example: Buy + orderType: + type: string + example: Market + limitPrice: + type: string + format: nullable + stopPrice: + type: string + format: nullable + isAllOrNone: + type: boolean + isAnonymous: + type: boolean + icebergQuantity: + type: string + format: nullable + minQuantity: + type: string + format: nullable + avgExecPrice: + type: integer + format: int32 + example: 0 + lastExecPrice: + type: string + format: nullable + source: + type: string + example: TradingAPI + timeInForce: + type: string + example: Day + gtdDate: + type: string + format: nullable + state: + type: string + example: Pending + rejectionReason: + type: string + example: None + chainId: + type: integer + format: int32 + example: 1069605761 + creationTime: + type: string + example: 2022-07-19T15:53:47.915000-04:00 + updateTime: + type: string + example: 2022-07-19T15:53:47.939000-04:00 + notes: + type: string + example: None + primaryRoute: + type: string + example: AUTO + secondaryRoute: + type: string + example: AUTO + orderRoute: + type: string + example: MX + venueHoldingOrder: + type: string + example: None + comissionCharged: + type: integer + format: int32 + example: 0 + exchangeOrderId: + type: string + example: None + isSignificantShareHolder: + type: boolean + isInsider: + type: boolean + isLimitOffsetInDollar: + type: boolean + userId: + type: integer + format: int32 + example: 514603 + placementCommission: + type: string + format: nullable + legs: + type: array + items: + type: object + properties: + legId: + type: integer + format: int32 + example: 0 + symbol: + type: string + example: AC21Oct22C30.00.MX + symbolId: + type: integer + format: int32 + example: 41790511 + legRatioQuantity: + type: integer + format: int32 + example: 1 + side: + type: string + example: BTO + avgExecPrice: + type: integer + format: int32 + example: 0 + lastExecPrice: + type: string + format: nullable + strategyType: + type: string + example: Strangle + triggerStopPrice: + type: string + format: nullable + orderGroupId: + type: integer + format: int32 + example: 0 + orderClass: + type: string + format: nullable + isCrossZero: + type: boolean + + OptionStrategy: + type: object + properties: + id: + $ref: "#/components/schemas/Id" + underlying_symbol_id: + $ref: "#/components/schemas/UniversalSymbol" + strategy_type: + type: string + example: BUTTERFLY + number_of_legs: + type: number + example: 2 + legs: + type: array + items: + properties: + option_symbol_id: + type: string + example: AAPLC20221111 + index: + type: number + example: 1 + action: + type: string + example: BUY_TO_OPEN + quantity: + type: number + example: 10 + + StrategyQuotes: + type: object + properties: + strategy: + $ref: "#/components/schemas/OptionStrategy" + open_price: + $ref: "#/components/schemas/Price" + bid_price: + $ref: "#/components/schemas/Price" + ask_price: + $ref: "#/components/schemas/Price" + volatility: + type: number + example: 0.141 + greek: + type: object + properties: + delta: + type: number + example: 0.1 + gamma: + type: number + example: 0.1 + theta: + type: number + example: 0.1 + vega: + type: number + example: 0.1 + rho: + type: number + example: 0.1 + StrategyOrderRecord: + description: Strategy order record + type: object + properties: + strategy: + $ref: "#/components/schemas/OptionStrategy" + status: + type: string + enum: + - PENDING + - ACCEPTED + - FAILED + - REJECTED + - CANCELED + - PARTIAL_CANCELED + - CANCEL_PENDING + - EXECUTED + - PARTIAL + - REPLACE_PENDING + - REPLACED + - STOPPED + - SUSPENDED + - EXPIRED + - QUEUED + - TRIGGERED + - ACTIVATED + - PENDING_RISK_REVIEW + - CONTINGENT_ORDER + filled_quantity: + type: number + example: 10 + open_quantity: + type: number + example: 10 + closed_quantity: + type: number + example: 10 + order_type: + $ref: "#/components/schemas/OrderType" + time_in_force: + $ref: "#/components/schemas/TimeInForce" + limit_price: + $ref: "#/components/schemas/Price" + execution_price: + $ref: "#/components/schemas/Price" + time_placed: + $ref: "#/components/schemas/Time" + time_updated: + $ref: "#/components/schemas/Time" + + SnapTradeHoldingsAccount: + description: SnapTradeUser Investment Account + type: object + properties: + id: + $ref: "#/components/schemas/Id" + brokerage_authorization: + $ref: "#/components/schemas/BrokerageAuthorization" + portfolio_group: + $ref: "#/components/schemas/Id" + name: + type: string + example: Registered Retirement Savings Account + nullable: true + number: + type: string + example: Q6542138443 + institution_name: + type: string + example: Alpaca + sync_status: + $ref: "#/components/schemas/AccountSyncStatus" + meta: + type: object + example: + type: Margin + status: ACTIVE + institution_name: Alpaca + + SnapTradeHoldingsAccountAccountId: + description: A single brokerage account at a financial institution. + type: object + properties: + id: + $ref: "#/components/schemas/AccountID" + brokerage_authorization: + $ref: "#/components/schemas/BrokerageAuthID" + portfolio_group: + $ref: "#/components/schemas/PortfolioGroupID" + name: + type: string + description: A display name for the account. Either assigned by the user or by the financial institution itself. For certain institutions, SnapTrade appends the institution name to the account name for clarity. + example: Robinhood Individual + nullable: true + number: + type: string + example: Q6542138443 + description: The account number assigned by the financial institution. + institution_name: + type: string + description: The name of the financial institution that holds the account. + example: Alpaca + balance: + nullable: true + allOf: + - $ref: "#/components/schemas/AccountBalance" + meta: + type: object + deprecated: true + description: Additional information about the account, such as account type, status, etc. This information is specific to the financial institution and there's no standard format for this data. Please use at your own risk. + example: + type: Margin + status: ACTIVE + institution_name: Alpaca + cash_restrictions: + type: array + deprecated: true + description: This field is deprecated. + items: + $ref: "#/components/schemas/CashRestriction" + created_date: + description: Timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format indicating when the account was created in SnapTrade. This is _not_ the account opening date at the financial institution. + type: string + format: date-time + example: 2024-07-23T22:50:22.761390Z + SnapTradeHoldingsTotalValue: + description: The total market value of the account. Note that this field is calculated based on the sum of the values of account positions and cash balances known to SnapTrade. It may not be accurate if the brokerage account has holdings that SnapTrade is not aware of. For example, if the brokerage account holds assets that SnapTrade does not support, the total value may be underreported. To get the brokerage reported total market value of the account, refer to `account.balance.total`. + type: object + properties: + value: + type: number + example: 32600.71 + description: Total value denominated in the currency of the `currency` field. + nullable: true + currency: + type: string + nullable: true + description: The ISO-4217 currency code for the amount. + example: USD + Balance: + description: Holds balance information for a single currency in an account. + type: object + properties: + currency: + $ref: "#/components/schemas/Currency" + cash: + type: number + description: The amount of available cash in the account denominated in the currency of the `currency` field. + example: 300.71 + nullable: true + buying_power: + type: number + description: Buying power only applies to margin accounts. For non-margin accounts, buying power should be the same as cash. Please note that this field is not always available for all brokerages. + example: 410.71 + nullable: true + ConsumerKey: + description: Shared key used to sign requests + type: string + example: UxrFb4cHdRWlmJKNuJjA6hoaN8uVa6jPGFVUl2UKHuKmurCnaU + Currency: + description: Describes a currency object. + type: object + properties: + id: + type: string + format: uuid + description: Unique identifier for the currency. This is the UUID used to reference the currency in SnapTrade. + example: 87b24961-b51e-4db8-9226-f198f6518a89 + code: + type: string + description: The ISO-4217 currency code for the currency. + example: USD + name: + type: string + description: A human-friendly name of the currency. + example: US Dollar + Exchange: + description: Stock Exchange + type: object + properties: + id: + $ref: "#/components/schemas/Id" + code: + type: string + example: TSX + mic_code: + type: string + example: XTSE + name: + type: string + example: Toronto Stock Exchange + timezone: + type: string + example: America/New_York + start_time: + type: string + example: 09:30:00 + close_time: + type: string + example: 16:00:00 + suffix: + type: string + example: .TO + nullable: true + USExchange: + description: US Stock Exchange + type: object + properties: + id: + $ref: "#/components/schemas/Id" + code: + type: string + example: ARCX + mic_code: + type: string + example: ARCA + name: + type: string + example: NYSE ARCA + timezone: + type: string + example: America/New_York + start_time: + type: string + example: 09:30:00 + close_time: + type: string + example: 16:00:00 + suffix: + type: string + example: None + nullable: true + allows_cryptocurrency_symbols: + type: boolean + example: false + JWT: + description: + JWT Token. Used to acess resources in private endpoints available + only through the Passiv app + type: object + properties: + token: + type: string + format: jwt + example: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VybmFtZSI6ImZSbUdsbWFyU1dtZDY5RDkyeGZWbVdCWUxCS0x0QiIsImV4cCI6MTU0MDA1NTMxOSwiZW1haWwiOiJ3b29kQHN5bmNocm92ZXJnZS5jb20iLCJvcmlnX2lhdCI6MTUzNzM3NjkxOX0.ZSn85i3kSBvEP5wuhWOE8_w903N1G1AfiVlD3fmri78 + LoginRedirectURI: + description: Redirect uri upon successful login + type: object + properties: + redirectURI: + example: https://app.snaptrade.com/snapTrade/redeemToken?token=this$token1does2ntactu4allyexist==&clientId=example + sessionId: + type: string + MockSignatureResponse: + description: Mock Signature Response + type: object + properties: + mockConsumerKey: + $ref: "#/components/schemas/ConsumerKey" + signedContent: + $ref: "#/components/schemas/SignedContent" + signature: + $ref: "#/components/schemas/Signature" + ClientID: + description: SnapTrade Client ID (generated and provided to partner by SnapTrade) + type: string + example: SNAPTRADETEST + UserID: + description: SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable. + type: string + example: snaptrade-user-123 + UserSecret: + description: SnapTrade User Secret (generated when registering user) + type: string + example: USERSECRET123 + PerformanceCustom: + description: Performance Custom Response Object + type: object + properties: + totalEquityTimeframe: + type: array + items: + $ref: "#/components/schemas/PastValue" + contributions: + $ref: "#/components/schemas/NetContributions" + contributionTimeframe: + type: array + items: + $ref: "#/components/schemas/PastValue" + contributionTimeframeCumulative: + type: array + items: + $ref: "#/components/schemas/PastValue" + withdrawalTimeframe: + type: array + items: + $ref: "#/components/schemas/PastValue" + contributionStreak: + type: number + example: 5 + description: Current streak of cosecutive months where contributions were made + nullable: true + contributionMonthsContributed: + type: number + example: 10 + description: Number of months in the timeframe with contributions + nullable: true + contributionTotalMonths: + type: number + example: 13 + description: Total months in timeframe + nullable: true + dividends: + type: array + items: + $ref: "#/components/schemas/NetDividend" + dividendIncome: + type: number + description: Total dividends received over the timeframe + example: 135.97 + nullable: true + monthlyDividends: + type: number + description: Average dividends received per month over the timeframe + example: 26.37 + nullable: true + badTickers: + type: array + items: + type: string + example: MAW105 + nullable: true + description: + list of tickers which may not be supported or may not have accurate + price data + dividendTimeline: + type: array + items: + $ref: "#/components/schemas/MonthlyDividends" + commissions: + type: number + example: 3.26 + description: commissions incurred during the timeframe + nullable: true + forexFees: + type: number + example: 5.26 + description: forex fees incurred during the timeframe + nullable: true + fees: + type: number + example: 2.72 + description: other fees incurred during the timeframe + nullable: true + rateOfReturn: + type: number + example: 0.082312367452 + description: + The return rate over the timeframe. Annualized if timeframe is + longer than 1 year + nullable: true + returnRateTimeframe: + type: array + items: + $ref: "#/components/schemas/SubPeriodReturnRate" + detailedMode: + type: boolean + description: + Whether the user has detailed mode enabled (more frequent data + points for totalEquity and contribution timeframes) + SubPeriodReturnRate: + type: object + properties: + periodStart: + $ref: "#/components/schemas/ReportingDate" + periodEnd: + $ref: "#/components/schemas/ReportingDate" + rateOfReturn: + type: number + example: 0.012312367452 + description: The return rate for the given period + nullable: true + DividendAtDate: + type: object + properties: + symbol: + type: string + example: AAPL + description: The ticker of the symbol that the dividend came from + nullable: true + amount: + type: number + example: 6.82 + description: The amount received from the dividend + nullable: true + currency: + type: string + example: CAD + description: The currency of the amount + PartnerData: + description: SnapTrade Partner metadata + type: object + properties: + redirect_uri: + type: string + description: + URI to redirect user back to after user is done adding brokerage + connections + example: https://example.com/oauth/snaptrade + allowed_brokerages: + type: array + description: Brokerages that can be accessed by partners + items: + $ref: "#/components/schemas/Brokerage" + name: + type: string + description: Name of Snaptrade Partner + example: Wealthy Chimpmunk + slug: + type: string + description: Slug of Snaptrade Partner + example: WEALTHYCHIPMUNK + logo_url: + type: string + description: URL to partner's logo + example: https://example.com/logo.png + pin_required: + type: boolean + description: Shows if pin is required by users to access connection page + example: false + can_access_trades: + type: boolean + description: Shows if users of Snaptrade partners can access trade endpoints + example: true + can_access_holdings: + type: boolean + description: Shows if Snaptrade partners can get user holdings data + example: true + can_access_account_history: + type: boolean + description: Shows if Snaptrade partners can get users account history data + example: true + can_access_reference_data: + type: boolean + description: Shows if Snaptrade partners can get users holdings data + example: true + can_access_portfolio_management: + type: boolean + description: + Shows if users Snaptrade partners can access portfolio group + management features + example: true + can_access_orders: + type: boolean + description: Shows if Snaptrade partners can get users account order history + example: true + Position: + description: Describes a single stock/ETF/crypto/mutual fund position in an account. + type: object + properties: + symbol: + $ref: "#/components/schemas/PositionSymbol" + units: + description: The number of shares of the position. This can be fractional or integer units. + type: number + example: 40 + nullable: true + price: + type: number + example: 113.15 + description: Last known market price for the symbol. The freshness of this price depends on the brokerage. Some brokerages provide real-time prices, while others provide delayed prices. It is recommended that you rely on your own third-party market data provider for most up to date prices. + nullable: true + open_pnl: + type: number + description: The profit or loss on the position since it was opened. This is calculated as the difference between the current market value of the position and the total cost of the position. It is recommended to calculate this value using the average purchase price and the current market price yourself, instead of relying on this field. + example: 0.44 + nullable: true + fractional_units: + deprecated: true + description: + Deprecated, use the `units` field for both fractional and integer + units going forward + type: number + nullable: true + example: 1.44 + average_purchase_price: + type: number + nullable: true + example: 108.3353 + description: + Cost basis _per share_ of this position. + RedirectTokenandPin: + description: Response when register user is successful + type: object + properties: + token: + type: string + example: myDAIBCP/EYqSmMByhMRB65aMa%2BdYhu2xRsGQe0sDd9SgZXMbdRh3eBaTh/bLViVGQoil6p9ytUUVhkqWalejOqCNVkXXTk/iNPTPaFCeh9%2B + pin: + type: string + example: usERdeFiP@1in9 + Signature: + description: > + Steps to generate a signature + * Prepare signed content (see SignedContent schema) + * Sign content prepared above with HMAC-SHA256 using the UTF-8 encoding + * Return base64 encoding of sign content along with headers + Note: Use the shared consumer key provided by SnapTrade to signed the request + Example python code + + ``` + + import hmac + + import json + + from base64 import b64encode + + from hashlib import sha256 + + from urllib.parse import urlencode + + consumer_key = "UxrFb4cHdRWlmJKNuJjA6hoaN8uVa6jPGFVUl2UKHuKmurCnaU".encode() + + request_data = {'userId': 'snaptrade-user-123', 'userSecret': 'CHRIS.P.BACON'} + + request_path = "/api/v1/snapTrade/mockSignature" + + request_query = "clientId=SNAPTRADETEST×tamp=1635790389" + + sig_object = {"content": request_data, "path": request_path, "query": request_query} + + sig_content = json.dumps(sig_object, separators=(",", ":"), sort_keys=True) + + sig_digest = hmac.new(consumer_key, sig_content.encode(), sha256).digest() + + signature = b64encode(sig_digest).decode() + + ``` + type: string + example: QJPQgW0Y8mWbG9Whw/fhCYofIgSo/UAo2AIc1bBPMnY= + SignedContent: + description: > + Signed content requires 3 key-value pairs + + * content -> Content included in request body, set to null if no content is included. Sort keys in content alphabetically + + * path -> Url path of request submitted + + * query -> Query params included in requests + + After preparing the key-value pairs, sort them alphabetically and convert them + + into a string. + + Note: + + Remove any extra whitespace characters and delimiters from the signed content. + + For example, some JSON rendering engines will produce output like this: + -- `{"blue": "moon", "hello": "world"}` + To produce the correct signature, the JSON should be processed to look like this: + -- `{"blue":"moon","hello":"world"}` + type: string + example: '{"content":{"userId":"snaptrade-user-123","userSecret":"CHRIS.P.BACON"},"path":"/api/v1/snapTrade/mockSignature","query":"clientId=SNAPTRADETEST×tamp=1635790389"}' + SnapTradeRegisterUserRequestBody: + description: Data required to register a user via SnapTrade Partner + type: object + properties: + userId: + $ref: "#/components/schemas/SnapTradeUserID" + SnapTradeLoginUserRequestBody: + description: Data to login a user via SnapTrade Partner + type: object + properties: + broker: + description: Slug of the brokerage to connect the user to. See [this document](https://snaptrade.notion.site/SnapTrade-Brokerage-Integrations-f83946a714a84c3caf599f6a945f0ead) for a list of supported brokerages and their slugs. + type: string + example: ALPACA + immediateRedirect: + description: When set to True, user will be redirected back to the partner's site instead of the connection portal + type: boolean + example: true + customRedirect: + description: URL to redirect the user to after the user connects their brokerage account + type: string + example: https://snaptrade.com + reconnect: + description: The UUID of the brokerage connection to be reconnected. This parameter should be left empty unless you are reconnecting a disabled connection. See ‘Reconnecting Accounts’ for more information. + type: string + example: 8b5f262d-4bb9-365d-888a-202bd3b15fa1 + connectionType: + description: Sets whether the connection should be read or trade + type: string + enum: + - read + - trade + connectionPortalVersion: + description: Sets the version of the connection portal to render, with a default to 'v3' + type: string + enum: + - v2 + - v3 + SnapTradeUserID: + description: SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable. + type: string + example: snaptrade-user-123 + SnapTradeUserSecret: + description: SnapTrade User Secret randomly generated by SnapTrade. This is privileged information and if compromised, should be rotated via the SnapTrade API. + type: string + example: h81@cx1lkalablakwjaltkejraj11= + Symbol: + description: Symbol + type: object + properties: + id: + $ref: "#/components/schemas/Id" + symbol: + type: string + example: VAB.TO + raw_symbol: + type: string + example: VAB + name: + type: string + example: Vanguard Canadian Aggregate Bond Index ETF + currency: + $ref: "#/components/schemas/Currency" + exchange: + $ref: "#/components/schemas/Exchange" + type: + $ref: "#/components/schemas/SecurityType" + figi_code: + type: string + example: BBG000B9XRY4 + nullable: true + figi_instrument: + nullable: true + allOf: + - $ref: "#/components/schemas/FigiInstrument" + Timestamp: + externalDocs: + url: https://en.wikipedia.org/wiki/Unix_time + description: Unix Epoch time + type: integer + example: 1635790389 + UserIDandSecret: + description: Response when register user is successful + type: object + properties: + userId: + $ref: "#/components/schemas/SnapTradeUserID" + userSecret: + $ref: "#/components/schemas/SnapTradeUserSecret" + UserList: + description: List of registered SnapTrade users + type: array + items: + type: string + example: + - user1 + - user2 + - user3 + DeleteUserResponse: + description: Response when delete user is successful + type: object + properties: + status: + type: string + example: deleted + description: Delete status + userId: + $ref: "#/components/schemas/SnapTradeUserID" + BrokerageAuthorizationType: + type: object + properties: + type: + type: string + enum: + - read + - trade + BrokerageAuthorizationTypeReadOnly: + type: object + properties: + id: + $ref: "#/components/schemas/Id" + type: + type: string + enum: + - read + - trade + auth_type: + type: string + enum: + - OAUTH + - SCRAPE + - UNOFFICIAL_API + - TOKEN + brokerage: + type: object + properties: + id: + $ref: "#/components/schemas/Id" + name: + type: string + example: Questrade + description: Full name of the brokerage. + slug: + type: string + example: QUESTRADE + description: + A unique identifier for that brokerage. It is usually the name of the brokerage in + capital letters and will never change. + Brokerage: + type: object + properties: + id: + $ref: "#/components/schemas/Id" + name: + type: string + example: Questrade + description: Full name of the brokerage. + display_name: + type: string + example: Questrade + description: A display-friendly name of the brokerage. + description: + type: string + example: Questrade is an online brokerage firm and wealth management firm based in Canada. It is Canada's largest discount broker. + aws_s3_logo_url: + type: string + format: url + example: https://www.snaptrade.com/questrade.logo + aws_s3_square_logo_url: + type: string + format: url + example: https://www.snaptrade.com/questrade.logo + nullable: true + open_url: + type: string + format: url + example: https://www.brokerage.com + nullable: true + slug: + type: string + example: QUESTRADE + description: + A unique identifier for that brokerage. It is usually the name of the brokerage in + capital letters and will never change. + url: + type: string + format: url + example: https://www.questrade.com/ + enabled: + type: boolean + example: true + maintenance_mode: + type: boolean + example: true + allows_fractional_units: + type: boolean + nullable: true + example: true + allows_trading: + type: boolean + nullable: true + example: true + has_reporting: + type: boolean + nullable: true + example: true + is_real_time_connection: + type: boolean + example: true + allows_trading_through_snaptrade_api: + type: boolean + nullable: true + example: true + is_scraping_integration: + type: boolean + example: true + default_currency: + $ref: "#/components/schemas/Id" + brokerage_type: + $ref: "#/components/schemas/BrokerageType" + exchanges: + description: List of exchange ID supported by brokerage + type: array + items: {} + example: + - 2bcd7cc3-e922-4976-bce1-9858296801c3 + - 4bcd8cc3-c122-4974-dc21-1858296801f4 + BrokerageAuthorization: + type: object + properties: + id: + $ref: "#/components/schemas/Id" + created_date: + $ref: "#/components/schemas/Time" + updated_date: + $ref: "#/components/schemas/Time" + brokerage: + $ref: "#/components/schemas/Brokerage" + name: + description: Connection Name + type: string + example: Connection-1 + type: + type: string + example: trade + disabled: + type: boolean + example: false + disabled_date: + description: Disabled date + type: string + nullable: true + example: 2022-01-21T15:11:19.217000-05:00 + meta: + description: Additional data about brokerage authorization + type: object + example: + identifier: 123456 + BrokerageAuthorizationRefreshConfirmation: + type: object + properties: + detail: + description: Refresh confirmation details + type: string + example: Connection 0b3ebefb-ed47-43df-cd8f-729a4420b5cf scheduled for refresh + BrokerageAuthorizationDisabledConfirmation: + type: object + properties: + detail: + description: Connection disabled confirmation + type: string + example: Connection 0b3ebefb-ed47-43df-cd8f-729a4420b5cf has been disabled + SessionEvent: + type: object + properties: + id: + $ref: "#/components/schemas/Id" + session_event_type: + type: string + enum: + - OAUTH_REDIRECT + - DISCLAIMER_ACCEPTED + - BROKERAGE_CONNECTION_INITIATED + - BROKERAGE_RECONNECT_INITIATED + - BROKERAGE_AUTHENTICATION + - OAUTH_BROKERAGE_AUTHENTICATION + - MFA_REQUESTED + - MFA_SUBMITTED + - MFA_CHOICE_REQUESTED + - MFA_CHOICE_SUBMITTED + - CONNECTION_SUCCESSFUL + - CONNECTION_FAILED + - PARTNER_REDIRECT + - CONNECTION_ABORTED + - SESSION_STARTED + session_id: + $ref: "#/components/schemas/Id" + user_id: + $ref: "#/components/schemas/SnapTradeUserID" + created_date: + $ref: "#/components/schemas/Time" + brokerage_status_code: + type: integer + nullable: true + example: 400 + brokerage_authorization_id: + $ref: "#/components/schemas/Id" + BrokerageSymbol: + description: Brokerage symbol + type: object + properties: + id: + $ref: "#/components/schemas/Id" + symbol: + allOf: + - $ref: "#/components/schemas/UniversalSymbol" + nullable: true + brokerage_authorization: + $ref: "#/components/schemas/BrokerageAuthorization" + description: + type: string + example: VANGUARD CDN AGGREGATE BOND INDEX ETF + allows_fractional_units: + type: boolean + example: true + nullable: true + option_symbol: + allOf: + - $ref: "#/components/schemas/OptionsSymbol" + nullable: true + OptionBrokerageSymbol: + description: Option Brokerage symbol + type: object + properties: + id: + $ref: "#/components/schemas/Id" + description: + type: string + example: SPY CALL 7/17 200 + option_symbol: + $ref: "#/components/schemas/OptionsSymbol" + PositionSymbol: + description: Symbol returned in position object + type: object + properties: + id: + $ref: "#/components/schemas/Id" + description: + type: string + example: VANGUARD CDN AGGREGATE BOND INDEX ETF + symbol: + $ref: "#/components/schemas/UniversalSymbol" + local_id: + type: string + example: "3291231" + nullable: true + is_quotable: + type: boolean + example: true + is_tradable: + type: boolean + example: true + CalculatedTrade: + description: Array of trades to make to rebalance portfolio + type: object + properties: + id: + $ref: "#/components/schemas/Id" + trades: + type: array + items: + $ref: "#/components/schemas/Trade" + OptionChain: + description: chain of options + type: array + items: + type: object + properties: + expiryDate: + type: string + example: 2022-07-08T00:00:00.000000-04:00 + description: + type: string + example: APPLE INC + listingExchange: + type: string + example: OPRA + optionExerciseType: + type: string + example: American + chainPerRoot: + type: array + items: + type: object + properties: + optionRoot: + type: string + example: AAPL + chainPerStrikePrice: + type: array + items: + type: object + properties: + strikePrice: + type: integer + format: int32 + example: 70 + nullable: true + callSymbolId: + type: integer + format: int32 + example: 42816081 + nullable: true + putSymbolId: + type: integer + format: int32 + example: 42816129 + nullable: true + multiplier: + type: integer + format: int32 + example: 100 + Email: + type: string + format: email + example: ops@snaptrade.com + ExchangeRatePairs: + description: The exchange rate of a pair of currencies + type: object + properties: + src: + $ref: "#/components/schemas/Currency" + dst: + $ref: "#/components/schemas/Currency" + exchange_rate: + type: number + example: 1.32 + ExcludedAsset: + description: An excluded asset in a portfolio group + type: object + properties: + symbol: + $ref: "#/components/schemas/UniversalSymbol" + Id: + type: string + format: uuid + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + ModelAssetClass: + type: object + properties: + id: + $ref: "#/components/schemas/Id" + name: + type: string + example: Bonds + ModelAssetClassDetails: + type: object + properties: + model_asset_class: + $ref: "#/components/schemas/ModelAssetClass" + model_asset_class_target: + type: array + items: + $ref: "#/components/schemas/ModelAssetClassTarget" + ModelAssetClassTarget: + type: object + properties: + symbol: + $ref: "#/components/schemas/UniversalSymbol" + ModelPortfolio: + type: object + properties: + id: + $ref: "#/components/schemas/Id" + name: + type: string + example: SnapTrade 5x Aggressive Growth Fund + model_type: + description: + "Enum definitions -> [-1: Unassigned, 0: Security Model Portfolio, + 1: Asset Class Portfolio]" + type: integer + enum: + - -1 + - 0 + - 1 + default: -1 + ModelPortfolioAssetClass: + type: object + properties: + model_asset_class: + $ref: "#/components/schemas/ModelAssetClass" + percent: + type: integer + minimum: 0 + maximum: 100 + example: 100 + ModelPortfolioDetails: + type: object + properties: + model_portfolio: + $ref: "#/components/schemas/ModelPortfolio" + model_portfolio_security: + type: array + items: + $ref: "#/components/schemas/ModelPortfolioSecurity" + model_portfolio_asset_class: + type: array + items: + $ref: "#/components/schemas/ModelPortfolioAssetClass" + ModelPortfolioSecurity: + type: object + properties: + symbol: + $ref: "#/components/schemas/UniversalSymbol" + percent: + type: integer + minimum: 0 + maximum: 100 + example: 100 + MonthlyDividends: + type: object + properties: + date: + $ref: "#/components/schemas/ReportingDate" + dividends: + type: array + items: + $ref: "#/components/schemas/DividendAtDate" + NetContributions: + type: object + properties: + date: + $ref: "#/components/schemas/ReportingDate" + contributions: + type: number + example: 524.74 + nullable: true + currency: + type: string + example: CAD + NetDividend: + description: Object representing total dividends received during a timeframe + type: object + properties: + symbol: + $ref: "#/components/schemas/UniversalSymbol" + amount: + type: number + example: 165.05 + nullable: true + currency: + type: string + example: USD + PastValue: + type: object + properties: + date: + $ref: "#/components/schemas/ReportingDate" + value: + type: number + example: 52.74 + currency: + type: string + example: CAD + Percent: + type: number + minimum: 0 + maximum: 100 + example: 90 + PortfolioGroupID: + description: Portfolio Group ID. Portfolio Groups have been deprecated. Please contact support if you have a usecase for it. + deprecated: true + type: string + format: uuid + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + PortfolioGroup: + type: object + properties: + id: + $ref: "#/components/schemas/Id" + name: + type: string + example: Combined Retirement Portfolio + PortfolioGroupInfo: + description: Summary of all relevant information about a portfolio group. + type: object + properties: + symbols: + type: array + items: + $ref: "#/components/schemas/UniversalSymbol" + quotable_symbols: + type: array + items: + $ref: "#/components/schemas/UniversalSymbol" + balances: + type: array + items: + $ref: "#/components/schemas/Balance" + positions: + type: array + items: + $ref: "#/components/schemas/Position" + target_positions: + type: array + items: + $ref: "#/components/schemas/TargetAsset" + ideal_positions: + type: array + items: + $ref: "#/components/schemas/Position" + excluded_positions: + type: array + items: + $ref: "#/components/schemas/ExcludedAsset" + calculated_trades: + type: array + items: + $ref: "#/components/schemas/CalculatedTrade" + brokerage_authorizations: + type: array + items: + $ref: "#/components/schemas/BrokerageAuthorization" + accuracy: + type: number + example: 0.962 + settings: + $ref: "#/components/schemas/PortfolioGroupSettings" + PortfolioGroupPosition: + description: Details of a security held + type: object + properties: + symbol: + $ref: "#/components/schemas/UniversalSymbol" + price: + type: number + example: 24.81 + description: Last known market price for the symbol + nullable: true + units: + type: integer + example: 15 + PortfolioGroupSettings: + type: object + properties: + buyOnly: + type: boolean + example: true + cash_optimizer: + type: boolean + example: true + notifyFrequency: + type: string + example: 7 00:00:00 + driftThreshold: + $ref: "#/components/schemas/Percent" + preferred_currency: + $ref: "#/components/schemas/Currency" + ReportingDate: + description: + Date used to specify timeframe for a reporting call (in YYYY-MM-DD + format) + type: string + example: "2022-01-24" + format: date + ReportingFrequency: + description: Optional frequency for the rate of return chart (defaults to + monthly). Possible values are weekly, monthly, quarterly, yearly. + type: string + example: monthly + Status: + description: Status of API + type: object + properties: + version: + type: integer + example: 151 + timestamp: + type: string + example: 2022-11-04T01:47:00.377969Z + online: + type: boolean + example: true + SymbolQuery: + description: Symbol query for searching for symbols + type: object + properties: + substring: + type: string + example: apple + SyncStatusDate: + description: + Date in YYYY-MM-DD format or null + type: string + example: "2022-01-24" + format: date + nullable: true + HoldingsSyncStatusDate: + description: + Date in ISO 8601 format or null (YYYY-MM-DD HH:MM:SS.mmmmmmTZ) + type: string + example: "2024-06-28 18:42:46.561408+00:00" + format: datetime + nullable: true + TargetAsset: + description: Target percentage of a certain asset + type: object + properties: + id: + $ref: "#/components/schemas/Id" + symbol: + $ref: "#/components/schemas/UniversalSymbol" + percent: + $ref: "#/components/schemas/Percent" + is_supported: + type: boolean + example: true + is_excluded: + type: boolean + example: true + meta: + type: object + nullable: true + TargetAssetList: + description: Target percentage of a certain asset + type: array + items: + $ref: "#/components/schemas/TargetAsset" + Trade: + description: A trade object + type: object + properties: + id: + $ref: "#/components/schemas/Id" + account: + $ref: "#/components/schemas/Account" + symbol: + $ref: "#/components/schemas/BrokerageSymbol" + universal_symbol: + $ref: "#/components/schemas/UniversalSymbol" + action: + type: string + enum: + - BUY + - SELL + example: BUY + units: + type: integer + example: 6 + price: + type: number + example: 24.81 + sequence: + type: integer + example: 1 + TradeExecutionStatus: + description: Execution status of a trade + type: object + properties: + symbol: + $ref: "#/components/schemas/BrokerageSymbol" + universal_symbol: + $ref: "#/components/schemas/UniversalSymbol" + trade: + $ref: "#/components/schemas/Trade" + state: + type: string + description: Execution state of a trade + enum: + - Executed + - Canceled + - Rejected + - Failed + - Not Executed + example: Executed + filled_units: + type: integer + description: Number of filled units + example: 3 + action: + type: string + description: Action of executed trade + enum: + - BUY + - SELL + example: SELL + price: + type: number + description: Price of execution + example: 23.44 + commissions: + type: number + description: Fees paid from executing trade + example: 23.44 + meta: + type: object + description: Other misc. data + example: + canceledUnits: 2 + TradeImpact: + description: Impact of a group of trade + type: object + properties: + account: + $ref: "#/components/schemas/Account" + currency: + $ref: "#/components/schemas/Currency" + remaining_cash: + type: number + description: Remaining balance after executing all trades + example: 1.01 + estimated_commissions: + type: number + description: Total estimated commissions across all trades to make + example: 10.05 + forex_fees: + type: number + description: Estimated forex fees to pay to excute trades + example: 2.01 + ManualTrade: + description: A manual trade object + type: object + properties: + id: + $ref: "#/components/schemas/Id" + account: + type: string + example: 2bcd7cc3-e922-4976-bce1-9855556801c3 + order_type: + $ref: "#/components/schemas/OrderTypeStrict" + time_in_force: + $ref: "#/components/schemas/TimeInForce" + symbol: + $ref: "#/components/schemas/ManualTradeSymbol" + action: + $ref: "#/components/schemas/ActionStrict" + units: + nullable: true + allOf: + - $ref: "#/components/schemas/Units" + price: + $ref: "#/components/schemas/Price" + ManualTradeSymbol: + description: Manual trade symbol object + type: object + properties: + brokerage_symbol_id: + $ref: "#/components/schemas/Id" + universal_symbol_id: + $ref: "#/components/schemas/Id" + currency: + $ref: "#/components/schemas/Currency" + local_id: + type: string + example: '1048101' + description: + type: string + example: Metaverse Global ETF + nullable: true + symbol: + type: string + example: MVGP.U.TO + ManualTradeBalance: + description: Balance + type: object + properties: + account: + $ref: "#/components/schemas/Account" + currency: + $ref: "#/components/schemas/Currency" + cash: + $ref: "#/components/schemas/Cash" + ManualTradeAndImpact: + description: Manual Trade and Impact object + type: object + properties: + trade: + $ref: "#/components/schemas/ManualTrade" + trade_impacts: + type: array + items: + $ref: "#/components/schemas/ManualTrade" + combined_remaining_balance: + $ref: "#/components/schemas/ManualTradeBalance" + SymbolsQuotes: + description: Symbols and Tickers Quotes object + type: array + items: + properties: + symbol: + $ref: "#/components/schemas/UniversalSymbol" + bid_price: + type: number + example: 8.43 + ask_price: + type: number + example: 8.43 + last_trade_price: + type: number + example: 8.74 + bid_size: + type: number + example: 260 + ask_size: + type: number + example: 344 + ManualTradeForm: + description: Manual Trade Form + type: object + properties: + account_id: + $ref: "#/components/schemas/Id" + action: + $ref: "#/components/schemas/ActionStrict" + order_type: + $ref: "#/components/schemas/OrderTypeStrict" + price: + $ref: "#/components/schemas/Price" + stop: + $ref: "#/components/schemas/StopPrice" + time_in_force: + $ref: "#/components/schemas/TimeInForceStrict" + units: + nullable: true + allOf: + - $ref: "#/components/schemas/Units" + universal_symbol_id: + $ref: "#/components/schemas/Id" + notional_value: + nullable: true + allOf: + - $ref: "#/components/schemas/NotionalValue" + ValidatedTradeBody: + description: Validated Trade Form + type: object + properties: + wait_to_confirm: + nullable: true + example: true + type: boolean + description: Optional, defaults to true. Determines if a wait is performed to check on order status. If false, latency will be reduced but orders returned will be more likely to be of status PENDING as we will not wait to check on the status before responding to the request + Cash: + description: Cash + type: number + example: 1.11 + nullable: true + OrderTypeStrict: + description: Order Type + type: string + enum: + - Limit + - Market + - StopLimit + - StopLoss + OrderType: + type: string + nullable: true + description: Order Type potential values include (but are not limited to) + - Limit + - Market + - StopLimit + - StopLoss + SnapTradeAPIDisclaimerAcceptStatus: + description: Status of user acceptance of SnapTrade API disclaimer + type: object + properties: + accepted: + type: boolean + timestamp: + type: string + example: 2022-01-21T15:11:19.217000-05:00 + TimeInForceStrict: + description: | + Trade time in force examples: + * FOK - Fill Or Kill + * Day - Day + * GTC - Good Til Canceled + type: string + enum: + - FOK + - Day + - GTC + TimeInForce: + description: | + Trade time in force examples: + * FOK - Fill Or Kill + * Day - Day + * GTC - Good Til Canceled + * GTD - Good Til Date + type: string + ActionStrict: + description: Trade Action + type: string + enum: + - BUY + - SELL + Action: + type: string + description: Trade Action potential values include (but are not limited to) + - BUY + - SELL + - BUY_COVER + - SELL_SHORT + - BUY_OPEN + - BUY_CLOSE + - SELL_OPEN + - SELL_CLOSE + Units: + description: Trade Units. Cannot work with notional value. + type: number + OpenUnits: + description: Trade Units + type: number + nullable: true + CancelledUnits: + description: Trade Units + type: number + nullable: true + FilledUnits: + description: Trade Units + type: number + nullable: true + Price: + description: Trade Price if limit or stop limit order + type: number + nullable: true + example: 31.33 + NotionalValue: + description: Dollar amount to trade. Cannot work with units. Can only work for market order types and day for time in force. **Only available for Alpaca, Alpaca Paper, and Robinhood.** + oneOf: + - type: string + - type: number + example: 100.00 + StopPrice: + description: + Stop Price. If stop loss or stop limit order, the price to trigger + the stop + type: number + example: 31.33 + nullable: true + UniversalActivity: + description: A transaction or activity from an institution + type: object + properties: + id: + type: string + example: 2f7dc9b3-5c33-4668-3440-2b31e056ebe6 + account: + $ref: "#/components/schemas/AccountSimple" + amount: + type: number + example: 263.82 + nullable: true + currency: + $ref: "#/components/schemas/Currency" + description: + type: string + example: WALT DISNEY UNIT DIST ON 21 SHS REC 12/31/21 PAY 01/06/22 + fee: + type: number + example: 0 + fx_rate: + type: number + example: 1.032 + nullable: true + description: The forex conversion rate involved in the transaction if provided by the brokerage. Used in cases where securities of one currency are purchased in a different currency, and the forex conversion is automatic. In those cases, price, amount and fee will be in the top level currency (activity -> currency) + institution: + type: string + example: SnapTrade Investr + option_type: + type: string + example: BUY_TO_OPEN + description: If an option transaction, then it's type (BUY_TO_OPEN, + SELL_TO_CLOSE, etc), otherwise empty string + price: + type: number + example: 0.4 + settlement_date: + type: string + example: 2022-01-06T05:00:00Z + external_reference_id: + type: string + nullable: true + description: Reference ID from brokerage used to identify related transactions. For example if an order comprises of several transactions (buy, fee, fx), they can be grouped if they share the same external_reference_id + example: 2f7dc9b3-5c33-4668-3440-2b31e056ebe6 + symbol: + $ref: "#/components/schemas/Symbol" + option_symbol: + $ref: "#/components/schemas/OptionsSymbol" + trade_date: + type: string + example: 2022-01-06T05:00:00Z + nullable: true + type: + type: string + description: + Potential values include (but are not limited to) + - DIVIDEND + - BUY + - SELL + - CONTRIBUTION + - WITHDRAWAL + - EXTERNAL_ASSET_TRANSFER_IN + - EXTERNAL_ASSET_TRANSFER_OUT + - INTERNAL_CASH_TRANSFER_IN + - INTERNAL_CASH_TRANSFER_OUT + - INTERNAL_ASSET_TRANSFER_IN + - INTERNAL_ASSET_TRANSFER_OUT + - INTEREST + - REBATE + - GOV_GRANT + - TAX + - FEE + - REI + - FXT + units: + type: number + description: Usually but not necessarily an integer + example: 5 + FigiInstrument: + description: Open FIGI Identifiers + type: object + properties: + figi_code: + type: string + example: BBG000B9Y5X2 + nullable: true + figi_share_class: + type: string + example: BBG001S5N8V8 + nullable: true + UniversalSymbol: + description: Universal symbol + type: object + properties: + id: + $ref: "#/components/schemas/Id" + symbol: + type: string + example: VAB.TO + raw_symbol: + type: string + example: VAB + description: + type: string + example: VANGUARD CDN AGGREGATE BOND INDEX ETF + nullable: true + currency: + $ref: "#/components/schemas/Currency" + exchange: + $ref: "#/components/schemas/Exchange" + type: + $ref: "#/components/schemas/SecurityType" + currencies: + type: array + items: + $ref: "#/components/schemas/Currency" + figi_code: + type: string + example: BBG000B9XRY4 + nullable: true + figi_instrument: + nullable: true + allOf: + - $ref: "#/components/schemas/FigiInstrument" + required: + - id + - symbol + - raw_symbol + - currency + - type + - currencies + UnderlyingSymbol: + description: Underlying Symbol + type: object + properties: + id: + $ref: "#/components/schemas/Id" + symbol: + type: string + example: SPY + description: + type: string + example: SPDR S&P 500 ETF Trust + nullable: true + currency: + $ref: "#/components/schemas/Currency" + exchange: + $ref: "#/components/schemas/USExchange" + type: + $ref: "#/components/schemas/SecurityType" + currencies: + type: array + items: + $ref: "#/components/schemas/Currency" + figi_code: + type: string + example: BBG000B9XRY4 + nullable: true + figi_instrument: + nullable: true + allOf: + - $ref: "#/components/schemas/FigiInstrument" + OptionsSymbol: + description: Options Symbol + type: object + required: + - id + - ticker + - option_type + - strike_price + - expiration_date + - underlying_symbol + properties: + id: + $ref: "#/components/schemas/Id" + ticker: + type: string + example: SPY 220819P00200000 + option_type: + type: string + enum: + - CALL + - PUT + example: CALL + strike_price: + type: number + example: 200 + expiration_date: + type: string + format: datetime + example: "2017-07-17T15:13:07.177712+00:00" + is_mini_option: + type: boolean + example: false + underlying_symbol: + $ref: "#/components/schemas/UnderlyingSymbol" + local_id: + type: string + example: "40817960" + exchange_id: + type: string + format: uuid + + OptionLeg: + description: Option Leg + type: object + properties: + action: + type: string + enum: + - BUY_TO_OPEN + - BUY_TO_CLOSE + - SELL_TO_OPEN + - SELL_TO_CLOSE + option_symbol_id: + type: string + description: Obtained from calling options chain endpoint (option_id) + example: SPY220819P00200000 + quantity: + type: number + example: 1 + SecurityType: + description: Security Type + type: object + properties: + id: + $ref: "#/components/schemas/Id" + code: + type: string + example: cs + description: + type: string + example: Common Stock + is_supported: + type: boolean + example: true + SnapTradePartnerAPICredential: + description: SnapTrade Partner brokerage api credentials + type: object + properties: + id: + $ref: "#/components/schemas/Id" + brokerage_api_client_id: + type: string + description: client id of snaptrade's partner brokerage app + redirect_uri: + type: string + example: https://www.example.com/oauth + description: Redirect uri for snaptrade's partner brokerage app + brokerage_authorization_type: + $ref: "#/components/schemas/BrokerageAuthorizationTypeReadOnly" + UserSettings: + description: User account settings + type: object + properties: + email: + $ref: "#/components/schemas/Email" + name: + type: string + example: James Bond + receive_cash_notification: + type: boolean + example: true + receive_drift_notification: + type: boolean + example: true + user_trial_activated: + type: boolean + example: true + activated_trial_date: + type: string + format: dateTime + example: "2017-07-17T15:13:07.177712+00:00" + demo: + type: boolean + example: false + api_enabled: + type: boolean + example: false + drift_threshold: + type: number + example: 95 + preferred_currency: + $ref: "#/components/schemas/Currency" + Time: + description: Time + type: string + example: 2022-01-21T15:11:19.217000-05:00 + BrokerageType: + description: Type of brokerage + type: object + properties: + id: + $ref: "#/components/schemas/Id" + name: + type: string + example: Traditional Brokerage + WebhookBase: + description: The base webhook content + type: object + properties: + webookId: + type: string + example: 06fe1fd7-fc50-43a7-b564-8a2c5f3bab44 + clientId: + type: string + example: WEALTHYCHIPMUNK + eventTimestamp: + type: string + example: 2022-01-21T15:11:19.217000-05:00 + userId: + type: string + example: external_user@test.com + UserErrorLog: + description: An API error log for a specific SnapTrade user. + type: object + properties: + requestedAt: + type: string + example: 2022-01-21T15:11:19.217000-05:00 + response: + type: string + statusCode: + type: number + example: 200 + queryParams: + type: string + httpMethod: + type: string + example: POST + endpoint: + type: string + example: api/v1/snapTrade + rsaPublicKey: + description: Open SSH RSA public key + type: string + example: ssh-rsa + AAAAB3NzaC1yc2EAAAADAQABAAAAgQC7vbqajDw4o6gJy8UtmIbkcpnkO3Kwc4qsEnSZp/TR+fQi62F79RHWmwKOtFmwteURgLbj7D/WGuNLGOfa/2vse3G2eHnHl5CB8ruRX9fBl/KgwCVr2JaEuUm66bBQeP5XeBotdR4cvX38uPYivCDdPjJ1QWPdspTBKcxeFbccDw== + encryptedResponse: + description: > + This response consists of 2 different components that must be + decrypted to obtain the decrypted message + + + * Decrypting the encryptedSharedKey + + The encrypted shared key is a shared key that was randomly generated by SnapTrade and encrypted using the users SSH public key provided when registering the user + It is needed to decrypt the message in step 2. + + To decrypt the shared key, the user should have access to their SSH private key stored locally in their device + + An example Python code on how to decrypt the shared key is shown below + + ``` + def decrypt_rsa_message(self, encrypted_message): + from Crypto.Cipher import PKCS1_OAEP + from Crypto.PublicKey import RSA + from base64 import b64decode + + f = open('private.pem', 'r') + private_key = RSA.import_key(f.read()) + cipher = PKCS1_OAEP.new(private_key) + + return cipher.decrypt(b64decode(encrypted_message.encode())).decode() + ``` + + * Decrypting the encryptedMessageData + + The data meant to be returned by an endpoint can be obtained by decrypting the encrypted message + + An encrypted message is a message that is encrypted using AES - MODE OCB with the shared key obtained in step one + + An example code to decrypt the encrypted message is shown below + + ``` + def decrypt_aes_message(self, shared_key, encrypted_message): + from Crypto.Cipher import AES + from base64 import b64decode + + encrypted_msg = b64decode(encrypted_message["encryptedMessage"].encode()) + tag = b64decode(encrypted_message["tag"].encode()) + nonce = b64decode(encrypted_message["nonce"].encode()) + cipher = AES.new(shared_key.encode(), AES.MODE_OCB, nonce=nonce) + + return cipher.decrypt_and_verify(encrypted_msg, tag).decode() + ``` + type: object + additionalProperties: false + properties: + encryptedSharedKey: + type: string + example: 5UEaY9QGzcNTr8y2jGDUI79jY1OdfK9x + encryptedMessageData: + type: object + properties: + encryptedMessage: + type: string + example: 9Xy05vqZOfp0OpW5fLAaDw== + tag: + type: string + example: mWZPkpQh5ktbcz6N7cTRmQ== + nonce: + type: string + example: None diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/header.png b/generator/konfig-integration-tests/sdks/java-additional-null-property/header.png new file mode 100644 index 0000000000..ce9f5e1d65 Binary files /dev/null and b/generator/konfig-integration-tests/sdks/java-additional-null-property/header.png differ diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/konfig.yaml b/generator/konfig-integration-tests/sdks/java-additional-null-property/konfig.yaml new file mode 100644 index 0000000000..19df010f87 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/konfig.yaml @@ -0,0 +1,68 @@ +# yaml-language-server: $schema=https://unpkg.com/konfig-lib@latest/konfig-yaml.schema.json + +order: + - tag: API Status + - tag: Authentication + operations: + - Authentication_registerSnapTradeUser + - Authentication_loginSnapTradeUser + - tag: Connections + - tag: Account Information + operations: + - path: /accounts + method: get + - tag: Trading + operations: + - Trading_getUserAccountQuotes + - Trading_getOrderImpact + - Trading_placeOrder + - Trading_placeForceOrder + - Trading_cancelUserAccountOrder +filterTags: + - Webhooks + - Development Tools + - Custom Brokerage API Credentials +filterModels: + - SnapTradePartnerAPICredential + - WebhookBase + - MockSignatureResponse +filterRequestBodies: + - CreateSnapTradeParterAPICredentialsRequestBody + - MockSignatureRequestBody +omitSecurityRequirementsFromTopLevelClient: + - PartnerSignature + - PartnerTimestamp +allObjectsHaveAdditionalProperties: + requestBody: false + exclude: + - encryptedResponse + - LoginRedirectURI + include: + - PortfolioGroup +outputDirectory: /tmp/snaptrade-sdks-out +infoContactName: SnapTrade +infoContactUrl: https://snaptrade.com/ +doNotValidateGloballyRequiredSecurity: true +tagPriority: + - Account Information +readmeHeader: + title: SnapTrade + image: header.png + url: https://snaptrade.com +useSecurityKeyName: true +generators: + java: + version: 5.0.30 + outputDirectory: sdks/java + readmeSnippet: snippets/java.java + clientName: Snaptrade + apiDocumentationAuthenticationPartial: snippets/javaDocAuthPartial.java + clientState: + - consumerKey + git: + host: github.com + userId: passiv + repoId: snaptrade-sdks/tree/master/sdks/java + groupId: com.konfigthis + artifactId: snaptrade-java-sdk +specPath: api.yaml diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/.gitignore b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/.gitignore new file mode 100644 index 0000000000..6f772bb53a --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/.gitignore @@ -0,0 +1,28 @@ +*.class + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.ear + +# exclude jar for gradle wrapper +!gradle/wrapper/*.jar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +# build files +**/target +target +.gradle +build + +# Ignore IntelliJ files +.idea +*.iml + +# Mac OS +.DS_Store diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/.konfigignore b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/.konfigignore new file mode 100644 index 0000000000..021389aa55 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/.konfigignore @@ -0,0 +1,2 @@ +src/test/java/com/konfigthis/client/GettingStartedTest.java +src/main/java/com/konfigthis/client/ApiClientCustom.java \ No newline at end of file diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/README.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/README.md new file mode 100644 index 0000000000..f50a756ad9 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/README.md @@ -0,0 +1,351 @@ +
+ +[![Visit SnapTrade](https://raw.githubusercontent.com/passiv/snaptrade-sdks/HEAD/sdks/java/header.png)](https://snaptrade.com) + +# [SnapTrade](https://snaptrade.com) + +Connect brokerage accounts to your app for live positions and trading + +[![Maven Central](https://img.shields.io/badge/Maven%20Central-v5.0.30-blue)](https://central.sonatype.com/artifact/com.konfigthis/snaptrade-java-sdk/5.0.30) +[![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/) + +
+ +## Requirements + +Building the API client library requires: + +1. Java 1.8+ +2. Maven (3.8.3+)/Gradle (7.2+) + +If you are adding this library to an Android Application or Library: + +3. Android 8.0+ (API Level 26+) + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn clean install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn clean deploy +``` + +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +```xml + + com.konfigthis + snaptrade-java-sdk + 5.0.30 + compile + +``` + +### Gradle users + +Add this dependency to your `build.gradle`: + +```groovy +// build.gradle +repositories { + mavenCentral() +} + +dependencies { + implementation "com.konfigthis:snaptrade-java-sdk:5.0.30" +} +``` + +### Android users + +Make sure your `build.gradle` file as a `minSdk` version of at least 26: +```groovy +// build.gradle +android { + defaultConfig { + minSdk 26 + } +} +``` + +Also make sure your library or application has internet permissions in your `AndroidManifest.xml`: + +```xml + + + + + +``` + +### Others + +At first generate the JAR by executing: + +```shell +mvn clean package +``` + +Then manually install the following JARs: + +* `target/snaptrade-java-sdk-5.0.30.jar` +* `target/lib/*.jar` + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java +import com.konfigthis.client.ApiException; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.model.*; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + + public static void main(String[] args) { + // 1) Initialize default client with clientID and consumerKey + Configuration configuration = new Configuration(); + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + Snaptrade snaptrade = new Snaptrade(configuration); + + // 2) Check that the client is able to make a request to the API server + Status status = snaptrade.apiStatus.check().execute(); + System.out.printf("SnapTrade is online: %s\n", status.getOnline()); + + // 3) Create a new user on SnapTrade + // The userId should be provided by you and refer to permanent value such as a + // database row ID + UUID userId = UUID.randomUUID(); + UserIDandSecret userIDandSecret = snaptrade.authentication.registerSnapTradeUser() + .userId(userId.toString()).execute(); + + new SnapTradeRegisterUserRequestBody().userId(userId.toString()); + // Note: A user secret is only generated once. It's required to access resources + // for certain endpoints + System.out.printf("userID: %s, userSecret: %s\n", userIDandSecret.getUserId(), + userIDandSecret.getUserSecret()); + + // 4) Get a redirect URI. Users will need this to connect their brokerage to the + // SnapTrade server + Map response = (Map) snaptrade.authentication + .loginSnapTradeUser(userIDandSecret.getUserId(), + userIDandSecret.getUserSecret()) + .execute(); + System.out.println(response.get("redirectURI")); + + // 5) Make a portfolio group and query + List portfolioGroupsFromPost = snaptrade.portfolioManagement.create( + userIDandSecret.getUserId(), userIDandSecret.getUserSecret()).id(UUID.randomUUID()) + .name("MyPortfolio").execute(); + System.out.println(portfolioGroupsFromPost); + List portfolioGroups = snaptrade.portfolioManagement.list(userIDandSecret.getUserId(), + userIDandSecret.getUserSecret()).execute(); + System.out.println(portfolioGroups); + + // 7) Query holdings and available brokerages + List holdings = snaptrade.accountInformation + .getAllUserHoldings(userIDandSecret.getUserId(), + userIDandSecret.getUserSecret()) + .execute(); + System.out.println(holdings); + List accounts = snaptrade.accountInformation.listUserAccounts(userIDandSecret.getUserId(), + userIDandSecret.getUserSecret()).execute(); + System.out.println(accounts); + List brokerages = snaptrade.referenceData.listAllBrokerages().execute(); + System.out.println(brokerages); + + // 8) Deleting a user + DeleteUserResponse deleteUserResponse = snaptrade.authentication + .deleteSnapTradeUser(userIDandSecret.getUserId()).execute(); + System.out.println(deleteUserResponse); + } +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *https://api.snaptrade.com/api/v1* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AccountInformationApi* | [**getAllUserHoldings**](docs/AccountInformationApi.md#getAllUserHoldings) | **GET** /holdings | List all accounts for the user, plus balances, positions, and orders for each account. +*AccountInformationApi* | [**getUserAccountBalance**](docs/AccountInformationApi.md#getUserAccountBalance) | **GET** /accounts/{accountId}/balances | List account balances +*AccountInformationApi* | [**getUserAccountDetails**](docs/AccountInformationApi.md#getUserAccountDetails) | **GET** /accounts/{accountId} | Return details of a specific investment account +*AccountInformationApi* | [**getUserAccountOrders**](docs/AccountInformationApi.md#getUserAccountOrders) | **GET** /accounts/{accountId}/orders | List account orders +*AccountInformationApi* | [**getUserAccountPositions**](docs/AccountInformationApi.md#getUserAccountPositions) | **GET** /accounts/{accountId}/positions | List account positions +*AccountInformationApi* | [**getUserHoldings**](docs/AccountInformationApi.md#getUserHoldings) | **GET** /accounts/{accountId}/holdings | List account holdings +*AccountInformationApi* | [**listUserAccounts**](docs/AccountInformationApi.md#listUserAccounts) | **GET** /accounts | List accounts +*AccountInformationApi* | [**updateUserAccount**](docs/AccountInformationApi.md#updateUserAccount) | **PUT** /accounts/{accountId} | Update details of an investment account +*ApiStatusApi* | [**check**](docs/ApiStatusApi.md#check) | **GET** / | Get API Status +*AuthenticationApi* | [**deleteSnapTradeUser**](docs/AuthenticationApi.md#deleteSnapTradeUser) | **DELETE** /snapTrade/deleteUser | Delete SnapTrade user +*AuthenticationApi* | [**listSnapTradeUsers**](docs/AuthenticationApi.md#listSnapTradeUsers) | **GET** /snapTrade/listUsers | List SnapTrade users +*AuthenticationApi* | [**loginSnapTradeUser**](docs/AuthenticationApi.md#loginSnapTradeUser) | **POST** /snapTrade/login | Login user & generate connection link +*AuthenticationApi* | [**registerSnapTradeUser**](docs/AuthenticationApi.md#registerSnapTradeUser) | **POST** /snapTrade/registerUser | Create SnapTrade user +*AuthenticationApi* | [**resetSnapTradeUserSecret**](docs/AuthenticationApi.md#resetSnapTradeUserSecret) | **POST** /snapTrade/resetUserSecret | Obtain a new user secret for a user +*ConnectionsApi* | [**detailBrokerageAuthorization**](docs/ConnectionsApi.md#detailBrokerageAuthorization) | **GET** /authorizations/{authorizationId} | Get brokerage authorization details +*ConnectionsApi* | [**disableBrokerageAuthorization**](docs/ConnectionsApi.md#disableBrokerageAuthorization) | **POST** /authorizations/{authorizationId}/disable | Manually disable a connection for testing +*ConnectionsApi* | [**listBrokerageAuthorizations**](docs/ConnectionsApi.md#listBrokerageAuthorizations) | **GET** /authorizations | List all brokerage authorizations for the User +*ConnectionsApi* | [**refreshBrokerageAuthorization**](docs/ConnectionsApi.md#refreshBrokerageAuthorization) | **POST** /authorizations/{authorizationId}/refresh | Refresh holdings for a connection +*ConnectionsApi* | [**removeBrokerageAuthorization**](docs/ConnectionsApi.md#removeBrokerageAuthorization) | **DELETE** /authorizations/{authorizationId} | Delete brokerage authorization +*ConnectionsApi* | [**sessionEvents**](docs/ConnectionsApi.md#sessionEvents) | **GET** /sessionEvents | Get all session events for a user +*OptionsApi* | [**getOptionStrategy**](docs/OptionsApi.md#getOptionStrategy) | **POST** /accounts/{accountId}/optionStrategy | Create options strategy +*OptionsApi* | [**getOptionsChain**](docs/OptionsApi.md#getOptionsChain) | **GET** /accounts/{accountId}/optionsChain | Get the options chain for a symbol +*OptionsApi* | [**getOptionsStrategyQuote**](docs/OptionsApi.md#getOptionsStrategyQuote) | **GET** /accounts/{accountId}/optionStrategy/{optionStrategyId} | Get options strategy quotes +*OptionsApi* | [**listOptionHoldings**](docs/OptionsApi.md#listOptionHoldings) | **GET** /accounts/{accountId}/options | Get account option holdings +*OptionsApi* | [**placeOptionStrategy**](docs/OptionsApi.md#placeOptionStrategy) | **POST** /accounts/{accountId}/optionStrategy/{optionStrategyId}/execute | Place an option strategy order +*ReferenceDataApi* | [**getCurrencyExchangeRatePair**](docs/ReferenceDataApi.md#getCurrencyExchangeRatePair) | **GET** /currencies/rates/{currencyPair} | Get exchange rate of a currency pair +*ReferenceDataApi* | [**getPartnerInfo**](docs/ReferenceDataApi.md#getPartnerInfo) | **GET** /snapTrade/partners | Get metadata related to Snaptrade partner +*ReferenceDataApi* | [**getSecurityTypes**](docs/ReferenceDataApi.md#getSecurityTypes) | **GET** /securityTypes | List of all security types +*ReferenceDataApi* | [**getStockExchanges**](docs/ReferenceDataApi.md#getStockExchanges) | **GET** /exchanges | Get exchanges +*ReferenceDataApi* | [**getSymbols**](docs/ReferenceDataApi.md#getSymbols) | **POST** /symbols | Search for symbols +*ReferenceDataApi* | [**getSymbolsByTicker**](docs/ReferenceDataApi.md#getSymbolsByTicker) | **GET** /symbols/{query} | Get details of a symbol +*ReferenceDataApi* | [**listAllBrokerageAuthorizationType**](docs/ReferenceDataApi.md#listAllBrokerageAuthorizationType) | **GET** /brokerageAuthorizationTypes | Get all brokerage authorization types +*ReferenceDataApi* | [**listAllBrokerages**](docs/ReferenceDataApi.md#listAllBrokerages) | **GET** /brokerages | Get brokerages +*ReferenceDataApi* | [**listAllCurrencies**](docs/ReferenceDataApi.md#listAllCurrencies) | **GET** /currencies | Get currencies +*ReferenceDataApi* | [**listAllCurrenciesRates**](docs/ReferenceDataApi.md#listAllCurrenciesRates) | **GET** /currencies/rates | Get currency exchange rates +*ReferenceDataApi* | [**symbolSearchUserAccount**](docs/ReferenceDataApi.md#symbolSearchUserAccount) | **POST** /accounts/{accountId}/symbols | Search for symbols available in an account +*TradingApi* | [**cancelUserAccountOrder**](docs/TradingApi.md#cancelUserAccountOrder) | **POST** /accounts/{accountId}/orders/cancel | Cancel open order in account +*TradingApi* | [**getOrderImpact**](docs/TradingApi.md#getOrderImpact) | **POST** /trade/impact | Check the impact of a trade on an account +*TradingApi* | [**getUserAccountQuotes**](docs/TradingApi.md#getUserAccountQuotes) | **GET** /accounts/{accountId}/quotes | Get symbol quotes +*TradingApi* | [**placeForceOrder**](docs/TradingApi.md#placeForceOrder) | **POST** /trade/place | Place a trade with NO validation. +*TradingApi* | [**placeOrder**](docs/TradingApi.md#placeOrder) | **POST** /trade/{tradeId} | Place order +*TransactionsAndReportingApi* | [**getActivities**](docs/TransactionsAndReportingApi.md#getActivities) | **GET** /activities | Get transaction history for a user +*TransactionsAndReportingApi* | [**getReportingCustomRange**](docs/TransactionsAndReportingApi.md#getReportingCustomRange) | **GET** /performance/custom | Get performance information for a specific timeframe + + +## Documentation for Models + + - [Account](docs/Account.md) + - [AccountBalance](docs/AccountBalance.md) + - [AccountBalanceNullable](docs/AccountBalanceNullable.md) + - [AccountHoldings](docs/AccountHoldings.md) + - [AccountHoldingsAccount](docs/AccountHoldingsAccount.md) + - [AccountOrderRecord](docs/AccountOrderRecord.md) + - [AccountOrderRecordStatus](docs/AccountOrderRecordStatus.md) + - [AccountSimple](docs/AccountSimple.md) + - [AccountSyncStatus](docs/AccountSyncStatus.md) + - [ActionStrict](docs/ActionStrict.md) + - [Amount](docs/Amount.md) + - [AmountNullable](docs/AmountNullable.md) + - [Balance](docs/Balance.md) + - [Brokerage](docs/Brokerage.md) + - [BrokerageAuthorization](docs/BrokerageAuthorization.md) + - [BrokerageAuthorizationDisabledConfirmation](docs/BrokerageAuthorizationDisabledConfirmation.md) + - [BrokerageAuthorizationRefreshConfirmation](docs/BrokerageAuthorizationRefreshConfirmation.md) + - [BrokerageAuthorizationType](docs/BrokerageAuthorizationType.md) + - [BrokerageAuthorizationTypeReadOnly](docs/BrokerageAuthorizationTypeReadOnly.md) + - [BrokerageAuthorizationTypeReadOnlyBrokerage](docs/BrokerageAuthorizationTypeReadOnlyBrokerage.md) + - [BrokerageSymbol](docs/BrokerageSymbol.md) + - [BrokerageType](docs/BrokerageType.md) + - [CalculatedTrade](docs/CalculatedTrade.md) + - [CashRestriction](docs/CashRestriction.md) + - [Currency](docs/Currency.md) + - [CurrencyNullable](docs/CurrencyNullable.md) + - [DeleteUserResponse](docs/DeleteUserResponse.md) + - [DividendAtDate](docs/DividendAtDate.md) + - [EncryptedResponse](docs/EncryptedResponse.md) + - [EncryptedResponseEncryptedMessageData](docs/EncryptedResponseEncryptedMessageData.md) + - [Exchange](docs/Exchange.md) + - [ExchangeRatePairs](docs/ExchangeRatePairs.md) + - [ExcludedAsset](docs/ExcludedAsset.md) + - [FigiInstrument](docs/FigiInstrument.md) + - [FigiInstrumentNullable](docs/FigiInstrumentNullable.md) + - [HoldingsStatus](docs/HoldingsStatus.md) + - [JWT](docs/JWT.md) + - [LoginRedirectURI](docs/LoginRedirectURI.md) + - [ManualTrade](docs/ManualTrade.md) + - [ManualTradeAndImpact](docs/ManualTradeAndImpact.md) + - [ManualTradeBalance](docs/ManualTradeBalance.md) + - [ManualTradeForm](docs/ManualTradeForm.md) + - [ManualTradeSymbol](docs/ManualTradeSymbol.md) + - [ModelAssetClass](docs/ModelAssetClass.md) + - [ModelAssetClassDetails](docs/ModelAssetClassDetails.md) + - [ModelAssetClassTarget](docs/ModelAssetClassTarget.md) + - [ModelPortfolio](docs/ModelPortfolio.md) + - [ModelPortfolioAssetClass](docs/ModelPortfolioAssetClass.md) + - [ModelPortfolioDetails](docs/ModelPortfolioDetails.md) + - [ModelPortfolioSecurity](docs/ModelPortfolioSecurity.md) + - [MonthlyDividends](docs/MonthlyDividends.md) + - [NetContributions](docs/NetContributions.md) + - [NetDividend](docs/NetDividend.md) + - [OptionBrokerageSymbol](docs/OptionBrokerageSymbol.md) + - [OptionChainInner](docs/OptionChainInner.md) + - [OptionChainInnerChainPerRootInner](docs/OptionChainInnerChainPerRootInner.md) + - [OptionChainInnerChainPerRootInnerChainPerStrikePriceInner](docs/OptionChainInnerChainPerRootInnerChainPerStrikePriceInner.md) + - [OptionLeg](docs/OptionLeg.md) + - [OptionStrategy](docs/OptionStrategy.md) + - [OptionStrategyLegsInner](docs/OptionStrategyLegsInner.md) + - [OptionsGetOptionStrategyRequest](docs/OptionsGetOptionStrategyRequest.md) + - [OptionsPlaceOptionStrategyRequest](docs/OptionsPlaceOptionStrategyRequest.md) + - [OptionsPosition](docs/OptionsPosition.md) + - [OptionsSymbol](docs/OptionsSymbol.md) + - [OptionsSymbolNullable](docs/OptionsSymbolNullable.md) + - [OrderTypeStrict](docs/OrderTypeStrict.md) + - [PartnerData](docs/PartnerData.md) + - [PastValue](docs/PastValue.md) + - [PerformanceCustom](docs/PerformanceCustom.md) + - [PortfolioGroup](docs/PortfolioGroup.md) + - [PortfolioGroupInfo](docs/PortfolioGroupInfo.md) + - [PortfolioGroupPosition](docs/PortfolioGroupPosition.md) + - [PortfolioGroupSettings](docs/PortfolioGroupSettings.md) + - [Position](docs/Position.md) + - [PositionSymbol](docs/PositionSymbol.md) + - [RedirectTokenandPin](docs/RedirectTokenandPin.md) + - [SecurityType](docs/SecurityType.md) + - [SessionEvent](docs/SessionEvent.md) + - [SnapTradeAPIDisclaimerAcceptStatus](docs/SnapTradeAPIDisclaimerAcceptStatus.md) + - [SnapTradeHoldingsAccount](docs/SnapTradeHoldingsAccount.md) + - [SnapTradeHoldingsAccountAccountId](docs/SnapTradeHoldingsAccountAccountId.md) + - [SnapTradeHoldingsTotalValue](docs/SnapTradeHoldingsTotalValue.md) + - [SnapTradeLoginUserRequestBody](docs/SnapTradeLoginUserRequestBody.md) + - [SnapTradeRegisterUserRequestBody](docs/SnapTradeRegisterUserRequestBody.md) + - [Status](docs/Status.md) + - [StrategyImpact](docs/StrategyImpact.md) + - [StrategyImpactLegsInner](docs/StrategyImpactLegsInner.md) + - [StrategyOrderPlace](docs/StrategyOrderPlace.md) + - [StrategyOrderPlaceOrdersInner](docs/StrategyOrderPlaceOrdersInner.md) + - [StrategyOrderPlaceOrdersInnerLegsInner](docs/StrategyOrderPlaceOrdersInnerLegsInner.md) + - [StrategyOrderRecord](docs/StrategyOrderRecord.md) + - [StrategyQuotes](docs/StrategyQuotes.md) + - [StrategyQuotesGreek](docs/StrategyQuotesGreek.md) + - [SubPeriodReturnRate](docs/SubPeriodReturnRate.md) + - [Symbol](docs/Symbol.md) + - [SymbolQuery](docs/SymbolQuery.md) + - [SymbolsQuotesInner](docs/SymbolsQuotesInner.md) + - [TargetAsset](docs/TargetAsset.md) + - [TimeInForceStrict](docs/TimeInForceStrict.md) + - [Trade](docs/Trade.md) + - [TradeExecutionStatus](docs/TradeExecutionStatus.md) + - [TradeImpact](docs/TradeImpact.md) + - [TradingCancelUserAccountOrderRequest](docs/TradingCancelUserAccountOrderRequest.md) + - [TransactionsStatus](docs/TransactionsStatus.md) + - [USExchange](docs/USExchange.md) + - [UnderlyingSymbol](docs/UnderlyingSymbol.md) + - [UniversalActivity](docs/UniversalActivity.md) + - [UniversalSymbol](docs/UniversalSymbol.md) + - [UniversalSymbolNullable](docs/UniversalSymbolNullable.md) + - [UserErrorLog](docs/UserErrorLog.md) + - [UserIDandSecret](docs/UserIDandSecret.md) + - [UserSettings](docs/UserSettings.md) + - [ValidatedTradeBody](docs/ValidatedTradeBody.md) + + +## Author +This Java package is automatically generated by [Konfig](https://konfigthis.com) diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/api/openapi.yaml b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/api/openapi.yaml new file mode 100644 index 0000000000..a8bf0334c8 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/api/openapi.yaml @@ -0,0 +1,10906 @@ +openapi: 3.0.0 +info: + contact: + email: api@snaptrade.com + name: SnapTrade + url: https://snaptrade.com/ + description: Connect brokerage accounts to your app for live positions and trading + termsOfService: N/A + title: SnapTrade + version: 1.0.0 + x-konfig-ignore: + potential-incorrect-type: true + x-readme: + explorer-enabled: false +servers: +- description: SnapTrade Production API + url: https://api.snaptrade.com/api/v1 +security: +- PartnerSignature: [] + PartnerClientId: [] + PartnerTimestamp: [] +tags: +- description: Check whether the API is operational and verify timestamps. + name: API Status +- description: Register and authenticate users with SnapTrade. + name: Authentication +- description: Retrieve and manage user connections. + name: Connections +- description: "Retrieve account information, such as positions, balances, etc." + name: Account Information +- description: Manage orders on user accounts + name: Trading +- description: Endpoints related to terms of conditions of SnapTrade API use + name: API Disclaimer +- description: "Retrieve information on account transactions, performance, dividends,\ + \ contributions, etc." + name: Transactions And Reporting +- description: "Retrieve basic information for API use, such as supported brokerages,\ + \ exchanges, currencies, etc." + name: Reference Data +- description: Endpoints to search for options prices and chains as well as place + options trades if supported. + name: Options +paths: + /: + get: + description: Check whether the API is operational and verify timestamps. + operationId: ApiStatus_check + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + description: API is operational. + default: + description: Unexpected error. + security: [] + summary: Get API Status + tags: + - API Status + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-get-- + x-accepts: application/json + /snapTrade/registerUser: + post: + description: | + Registers a new SnapTrade user under your ClientID. A user secret will be automatically generated for you and must be properly stored in your database. + Most SnapTrade operations require a user ID and user secret to be passed as a parameter. + operationId: Authentication_registerSnapTradeUser + requestBody: + $ref: '#/components/requestBodies/RegisterUserRequestBody' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/UserIDandSecret' + description: Successfully registered user + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/400FailedRequestResponse' + description: Bad Request. Could be caused by various reasons. Error message + is provided in response + x-do-not-generate: true + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/404FailedRequestResponse' + description: Invalid SnapTrade Client ID provided in query + x-do-not-generate: true + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/500UnexpectedExceptionResponse' + description: Unexpected error + x-do-not-generate: true + summary: Create SnapTrade user + tags: + - Authentication + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-post--snapTrade-registerUser + x-content-type: application/json + x-accepts: application/json + /snapTrade/login: + post: + description: Logs in a SnapTrade user and returns an authenticated connection + portal URL for them to use to connect a brokerage account. + operationId: Authentication_loginSnapTradeUser + parameters: + - explode: true + in: query + name: userId + required: true + schema: + $ref: '#/components/schemas/UserID' + style: form + - explode: true + in: query + name: userSecret + required: true + schema: + $ref: '#/components/schemas/UserSecret' + style: form + requestBody: + $ref: '#/components/requestBodies/SnapTradeLoginUserRequestBody' + responses: + "200": + content: + application/json: + schema: {} + description: Login successful. Redirect user to provided URI in response + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/400FailedRequestResponse' + description: Bad Request + x-do-not-generate: true + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/403FailedRequestResponse' + description: Forbidden + x-do-not-generate: true + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/404FailedRequestResponse' + description: Not Found + x-do-not-generate: true + "500": + description: Unexpected Error + summary: Login user & generate connection link + tags: + - Authentication + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-post--snapTrade-login + x-content-type: application/json + x-accepts: application/json + /snapTrade/listUsers: + get: + description: Returns a list of users you've registered over the SnapTrade API. + operationId: Authentication_listSnapTradeUsers + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/UserList' + description: Successfully retrieved a list of users + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/400FailedRequestResponse' + description: Bad Request. Could be caused by various reasons. Error message + is provided in response + x-do-not-generate: true + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/404FailedRequestResponse' + description: Invalid SnapTrade Client ID provided in query + x-do-not-generate: true + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/500UnexpectedExceptionResponse' + description: Unexpected error + x-do-not-generate: true + summary: List SnapTrade users + tags: + - Authentication + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-get--snapTrade-listUsers + x-accepts: application/json + /snapTrade/deleteUser: + delete: + description: "Deletes a user you've registered over the SnapTrade API, and any\ + \ data associated with them or their investment accounts." + operationId: Authentication_deleteSnapTradeUser + parameters: + - explode: true + in: query + name: userId + required: true + schema: + $ref: '#/components/schemas/UserID' + style: form + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteUserResponse' + description: Delete successful + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/400FailedRequestResponse' + description: Bad Request + x-do-not-generate: true + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/403FailedRequestResponse' + description: Forbidden + x-do-not-generate: true + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/404FailedRequestResponse' + description: Not Found + x-do-not-generate: true + "500": + description: Unexpected Error + summary: Delete SnapTrade user + tags: + - Authentication + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-delete--snapTrade-deleteUser + x-accepts: application/json + /snapTrade/resetUserSecret: + post: + description: | + This API is used to rotate the secret for a SnapTrade user. You might use this if a userSecret + is compromised. Please note that if you call this endpoint and fail to save the new secret, you'll no longer be able to access any data for this user, and your only option will be to delete and recreate the user, then ask them to reconnect. + operationId: Authentication_resetSnapTradeUserSecret + requestBody: + $ref: '#/components/requestBodies/ResetUserSecretRequestBody' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/UserIDandSecret' + description: New user secret is generated + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/400FailedRequestResponse' + description: Bad Request. Could be caused by various reasons. Error message + is provided in response + x-do-not-generate: true + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/401FailedRequestResponse' + description: "Failed authenticaion. Wrong clientId, userId or userSecret\ + \ provided" + x-do-not-generate: true + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/500UnexpectedExceptionResponse' + description: Unexpected error + x-do-not-generate: true + summary: Obtain a new user secret for a user + tags: + - Authentication + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-post--snapTrade-resetUserSecret + x-content-type: application/json + x-accepts: application/json + /authorizations: + get: + description: Returns a list of Brokerage Authorization objects for the user + operationId: Connections_listBrokerageAuthorizations + parameters: + - explode: true + in: query + name: userId + required: true + schema: + $ref: '#/components/schemas/UserID' + style: form + - explode: true + in: query + name: userSecret + required: true + schema: + $ref: '#/components/schemas/UserSecret' + style: form + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/BrokerageAuthorization' + type: array + x-konfig-is-used-in-successful-response: true + description: A list of all Authorization objects for the authenticated user. + default: + description: Unexpected error. + summary: List all brokerage authorizations for the User + tags: + - Connections + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-get--authorizations + x-accepts: application/json + /authorizations/{authorizationId}: + delete: + description: Deletes a specified brokerage authorization given by the ID. + operationId: Connections_removeBrokerageAuthorization + parameters: + - description: The ID of the Authorization to delete. + explode: false + in: path + name: authorizationId + required: true + schema: + $ref: '#/components/schemas/Id' + style: simple + - explode: true + in: query + name: userId + required: true + schema: + $ref: '#/components/schemas/UserID' + style: form + - explode: true + in: query + name: userSecret + required: true + schema: + $ref: '#/components/schemas/UserSecret' + style: form + responses: + "204": + description: Brokerage authorization object has been successfully deleted + "400": + description: The specified authorizationId is invalid (not a UUID string). + "404": + description: The specified authorizationId was not found. + default: + description: Unexpected error. + summary: Delete brokerage authorization + tags: + - Connections + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-delete--authorizations-authorizationId + x-accepts: application/json + get: + description: Returns a single brokerage authorization object for the specified + ID. + operationId: Connections_detailBrokerageAuthorization + parameters: + - description: The ID of a brokerage authorization object. + explode: false + in: path + name: authorizationId + required: true + schema: + $ref: '#/components/schemas/Id' + style: simple + - explode: true + in: query + name: userId + required: true + schema: + $ref: '#/components/schemas/UserID' + style: form + - explode: true + in: query + name: userSecret + required: true + schema: + $ref: '#/components/schemas/UserSecret' + style: form + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/BrokerageAuthorization' + description: Authorization object for the authenticated user. + default: + description: Unexpected error. + summary: Get brokerage authorization details + tags: + - Connections + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-get--authorizations-authorizationId + x-accepts: application/json + /authorizations/{authorizationId}/refresh: + post: + description: Trigger a holdings update for all accounts under this authorization. + Updates will be queued asynchronously. ACCOUNT_HOLDINGS_UPDATED webhook will + be sent once the sync completes. Please contact support for access as this + endpoint is not enabled by default + operationId: Connections_refreshBrokerageAuthorization + parameters: + - description: The ID of a brokerage authorization object. + explode: false + in: path + name: authorizationId + required: true + schema: + $ref: '#/components/schemas/Id' + style: simple + - explode: true + in: query + name: userId + required: true + schema: + $ref: '#/components/schemas/UserID' + style: form + - explode: true + in: query + name: userSecret + required: true + schema: + $ref: '#/components/schemas/UserSecret' + style: form + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/BrokerageAuthorizationRefreshConfirmation' + description: Confirmation that the syncs have been scheduled + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/401FailedRequestResponse' + description: "Unauthorized, invalid credentials for this resource" + x-do-not-generate: true + "402": + content: + application/json: + schema: + $ref: '#/components/schemas/402BrokerageAuthDisabledResponse' + description: Unable to sync with brokerage account because the connection + is disabled. + x-do-not-generate: true + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/403FeatureNotEnabledResponse' + description: Customer or user does not have access to this feature + x-do-not-generate: true + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/404FailedRequestResponse' + description: The requested resource does not exist. + x-do-not-generate: true + summary: Refresh holdings for a connection + tags: + - Connections + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-post--authorizations-authorizationId-refresh + x-accepts: application/json + /authorizations/{authorizationId}/disable: + post: + description: "Manually disable a connection. This should only be used for testing\ + \ a reconnect flow, and never used on production connections. Will trigger\ + \ a disconnect as if it happened naturally, and send a CONNECTION_BROKEN webhook\ + \ for the connection. Please contact us in order to use this endpoint as it\ + \ is disabled by default." + operationId: Connections_disableBrokerageAuthorization + parameters: + - description: The ID of a brokerage authorization object. + explode: false + in: path + name: authorizationId + required: true + schema: + $ref: '#/components/schemas/Id' + style: simple + - explode: true + in: query + name: userId + required: true + schema: + $ref: '#/components/schemas/UserID' + style: form + - explode: true + in: query + name: userSecret + required: true + schema: + $ref: '#/components/schemas/UserSecret' + style: form + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/BrokerageAuthorizationDisabledConfirmation' + description: Confirmation that the connection has been disabled + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/401FailedRequestResponse' + description: "Unauthorized, invalid credentials for this resource" + x-do-not-generate: true + "402": + content: + application/json: + schema: + $ref: '#/components/schemas/402BrokerageAuthAlreadyDisabledException' + description: Unable to sync with brokerage account because the connection + is disabled. + x-do-not-generate: true + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/403FeatureNotEnabledResponse' + description: Customer or user does not have access to this feature + x-do-not-generate: true + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/404FailedRequestResponse' + description: The requested resource does not exist. + x-do-not-generate: true + summary: Manually disable a connection for testing + tags: + - Connections + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-post--authorizations-authorizationId-disable + x-accepts: application/json + /sessionEvents: + get: + description: Returns a list of session events associated with a user. + operationId: Connections_sessionEvents + parameters: + - explode: true + in: query + name: PartnerClientId + required: true + schema: + $ref: '#/components/schemas/ClientID' + style: form + - description: Optional comma seperated list of user IDs used to filter the + request on specific users + explode: true + in: query + name: userId + required: false + schema: + $ref: '#/components/schemas/AccountIDs' + style: form + - description: Optional comma seperated list of session IDs used to filter the + request on specific users + explode: true + in: query + name: sessionId + required: false + schema: + $ref: '#/components/schemas/AccountIDs' + style: form + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/SessionEvent' + type: array + x-konfig-is-used-in-successful-response: true + description: A list of all Session Events for the Partner. + default: + description: Unexpected error. + summary: Get all session events for a user + tags: + - Connections + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-get--sessionEvents + x-accepts: application/json + /accounts: + get: + description: Get a list of all Account objects for the authenticated SnapTrade + user. + operationId: AccountInformation_listUserAccounts + parameters: + - explode: true + in: query + name: userId + required: true + schema: + $ref: '#/components/schemas/UserID' + style: form + - explode: true + in: query + name: userSecret + required: true + schema: + $ref: '#/components/schemas/UserSecret' + style: form + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Account' + type: array + x-konfig-is-used-in-successful-response: true + description: A list of all Account objects for the authenticated user. + default: + description: Unexpected error. + summary: List accounts + tags: + - Account Information + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-get--accounts + x-accepts: application/json + /holdings: + get: + deprecated: true + description: | + **Deprecated, please use the account-specific holdings endpoint instead.** + + List all accounts for the user, plus balances, positions, and orders for each + account. + operationId: AccountInformation_getAllUserHoldings + parameters: + - explode: true + in: query + name: userId + required: true + schema: + $ref: '#/components/schemas/UserID' + style: form + - explode: true + in: query + name: userSecret + required: true + schema: + $ref: '#/components/schemas/UserSecret' + style: form + - description: Optional. Comma seperated list of authorization IDs (only use + if filtering is needed on one or more authorizations). + explode: true + in: query + name: brokerage_authorizations + required: false + schema: + example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + format: uuid + type: string + x-konfig-original-example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + x-konfig-generated-schema: konfig-generated-schema-paths--holdings-get-parameters-2-schema + style: form + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/AccountHoldings' + type: array + x-konfig-is-used-in-successful-response: true + description: Returns list of accounts and holdings + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/400FailedRequestResponse' + description: Bad Request + x-do-not-generate: true + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/403FailedRequestResponse' + description: Forbidden + x-do-not-generate: true + "500": + description: Unexpected Error + summary: "List all accounts for the user, plus balances, positions, and orders\ + \ for each account." + tags: + - Account Information + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-get--holdings + x-accepts: application/json + /accounts/{accountId}/holdings: + get: + description: | + Lists balances, positions, option positions, and recent orders for the specified account. The data returned is similar to the data returned over the more fine-grained [balances](/reference/Account%20Information/AccountInformation_getUserAccountBalance), [positions](/reference/Account%20Information/AccountInformation_getUserAccountPositions) and [orders](/reference/Account%20Information/AccountInformation_getUserAccountOrders) endpoints. __The finer-grained APIs are preferred. They are easier to work with, faster, and have better error handling than this coarse-grained API.__ + operationId: AccountInformation_getUserHoldings + parameters: + - explode: false + in: path + name: accountId + required: true + schema: + $ref: '#/components/schemas/AccountID' + style: simple + - explode: true + in: query + name: userId + required: true + schema: + $ref: '#/components/schemas/UserID' + style: form + - explode: true + in: query + name: userSecret + required: true + schema: + $ref: '#/components/schemas/UserSecret' + style: form + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/AccountHoldingsAccount' + description: OK + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/400FailedRequestResponse' + description: Bad Request + x-do-not-generate: true + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/403FailedRequestResponse' + description: Forbidden + x-do-not-generate: true + "500": + description: Unexpected Error + summary: List account holdings + tags: + - Account Information + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-get--accounts-accountId-holdings + x-accepts: application/json + /accounts/{accountId}: + get: + description: | + Returns an account object with details for the specified account, + including the total account market value. + operationId: AccountInformation_getUserAccountDetails + parameters: + - explode: true + in: query + name: userId + required: true + schema: + $ref: '#/components/schemas/UserID' + style: form + - explode: true + in: query + name: userSecret + required: true + schema: + $ref: '#/components/schemas/UserSecret' + style: form + - description: The ID of the account to get detail of. + explode: false + in: path + name: accountId + required: true + schema: + example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + format: uuid + type: string + x-konfig-original-example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + x-konfig-generated-schema: konfig-generated-schema-paths--accounts-accountId-get-parameters-2-schema + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Account' + description: Details of a specific investment account + default: + description: Unexpected error + summary: Return details of a specific investment account + tags: + - Account Information + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-get--accounts-accountId + x-accepts: application/json + put: + description: Updates various properties of a specified account. + operationId: AccountInformation_updateUserAccount + parameters: + - explode: true + in: query + name: userId + required: true + schema: + $ref: '#/components/schemas/UserID' + style: form + - explode: true + in: query + name: userSecret + required: true + schema: + $ref: '#/components/schemas/UserSecret' + style: form + - description: The ID of the account to update. + explode: false + in: path + name: accountId + required: true + schema: + format: uuid + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Account' + type: array + x-konfig-is-used-in-successful-response: true + description: Successfully updated details of an investment account + default: + description: Unexpected error + summary: Update details of an investment account + tags: + - Account Information + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-put--accounts-accountId + x-accepts: application/json + /accounts/{accountId}/balances: + get: + description: A list of account balances for the specified account (one per currency + that the account holds). + operationId: AccountInformation_getUserAccountBalance + parameters: + - explode: true + in: query + name: userId + required: true + schema: + $ref: '#/components/schemas/UserID' + style: form + - explode: true + in: query + name: userSecret + required: true + schema: + $ref: '#/components/schemas/UserSecret' + style: form + - description: The ID of the account to get balances. + explode: false + in: path + name: accountId + required: true + schema: + example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + format: uuid + type: string + x-konfig-original-example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + x-konfig-generated-schema: konfig-generated-schema-paths--accounts-accountId-balances-get-parameters-2-schema + style: simple + responses: + "200": + content: + '*/*': + schema: + items: + $ref: '#/components/schemas/Balance' + type: array + x-konfig-is-used-in-successful-response: true + description: List of all balances in investment account + default: + description: Unexpected error + summary: List account balances + tags: + - Account Information + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-get--accounts-accountId-balances + x-accepts: '*/*' + /accounts/{accountId}/positions: + get: + description: Returns a list of positions in the specified account. + operationId: AccountInformation_getUserAccountPositions + parameters: + - explode: true + in: query + name: userId + required: true + schema: + $ref: '#/components/schemas/UserID' + style: form + - explode: true + in: query + name: userSecret + required: true + schema: + $ref: '#/components/schemas/UserSecret' + style: form + - description: The ID of the account to get positions. + explode: false + in: path + name: accountId + required: true + schema: + example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + format: uuid + type: string + x-konfig-original-example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + x-konfig-generated-schema: konfig-generated-schema-paths--accounts-accountId-positions-get-parameters-2-schema + style: simple + responses: + "200": + content: + '*/*': + schema: + items: + $ref: '#/components/schemas/Position' + type: array + x-konfig-is-used-in-successful-response: true + description: List all positions in investment account + default: + description: Unexpected error + summary: List account positions + tags: + - Account Information + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-get--accounts-accountId-positions + x-accepts: '*/*' + /accounts/{accountId}/orders: + get: + description: Fetch all recent orders from a user's account. + operationId: AccountInformation_getUserAccountOrders + parameters: + - explode: true + in: query + name: userId + required: true + schema: + $ref: '#/components/schemas/UserID' + style: form + - explode: true + in: query + name: userSecret + required: true + schema: + $ref: '#/components/schemas/UserSecret' + style: form + - description: defaults value is set to "all" + explode: true + in: query + name: state + required: false + schema: + enum: + - all + - open + - executed + type: string + style: form + - description: Number of days in the past to fetch the most recent orders. Defaults + to the last 30 days if no value is passed in. + explode: true + in: query + name: days + required: false + schema: + example: 30 + format: int32 + minimum: 1 + type: integer + x-konfig-original-example: 30 + x-konfig-generated-schema: konfig-generated-schema-paths--accounts-accountId-orders-get-parameters-3-schema + style: form + - description: The ID of the account to get orders. + explode: false + in: path + name: accountId + required: true + schema: + example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + format: uuid + type: string + x-konfig-original-example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + x-konfig-generated-schema: konfig-generated-schema-paths--accounts-accountId-orders-get-parameters-4-schema + style: simple + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/AccountOrderRecord' + type: array + x-konfig-is-used-in-successful-response: true + description: List all orders in account + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/500UnexpectedExceptionResponse' + description: Unexpected error + x-do-not-generate: true + summary: List account orders + tags: + - Account Information + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-get--accounts-accountId-orders + x-accepts: application/json + /accounts/{accountId}/quotes: + get: + description: Returns quote(s) from the brokerage for the specified symbol(s). + operationId: Trading_getUserAccountQuotes + parameters: + - explode: true + in: query + name: userId + required: true + schema: + $ref: '#/components/schemas/UserID' + style: form + - explode: true + in: query + name: userSecret + required: true + schema: + $ref: '#/components/schemas/UserSecret' + style: form + - description: List of universal_symbol_id or tickers to get quotes for. + explode: true + in: query + name: symbols + required: true + schema: + type: string + style: form + - description: Should be set to True if providing tickers. + explode: true + in: query + name: use_ticker + required: false + schema: + type: boolean + style: form + - description: The ID of the account to get quotes. + explode: false + in: path + name: accountId + required: true + schema: + example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + format: uuid + type: string + x-konfig-original-example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + x-konfig-generated-schema: konfig-generated-schema-paths--accounts-accountId-quotes-get-parameters-4-schema + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/SymbolsQuotes' + description: Returns quotes object with different prices + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/500UnexpectedExceptionResponse' + description: Unexpected error + x-do-not-generate: true + summary: Get symbol quotes + tags: + - Trading + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-get--accounts-accountId-quotes + x-accepts: application/json + /trade/impact: + post: + description: Return the trade object and it's impact on the account for the + specified order. + operationId: Trading_getOrderImpact + parameters: + - explode: true + in: query + name: userId + required: true + schema: + $ref: '#/components/schemas/UserID' + style: form + - explode: true + in: query + name: userSecret + required: true + schema: + $ref: '#/components/schemas/UserSecret' + style: form + requestBody: + $ref: '#/components/requestBodies/ManualTradeFormRequestBody' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ManualTradeAndImpact' + description: Return trade object and it's impact on the account + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/400FailedRequestResponse' + description: Missing or wrong data format provided in request body + x-do-not-generate: true + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/403FailedRequestResponse' + description: User does not have permissions to place trades + x-do-not-generate: true + "500": + description: Unexpected Error + summary: Check the impact of a trade on an account + tags: + - Trading + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-post--trade-impact + x-content-type: application/json + x-accepts: application/json + /trade/{tradeId}: + post: + description: | + Places the specified trade object. This places the order in the account and + returns the status of the order from the brokerage. + operationId: Trading_placeOrder + parameters: + - description: The ID of trade object obtained from trade/impact endpoint + explode: false + in: path + name: tradeId + required: true + schema: + format: uuid + type: string + style: simple + - explode: true + in: query + name: userId + required: true + schema: + $ref: '#/components/schemas/UserID' + style: form + - explode: true + in: query + name: userSecret + required: true + schema: + $ref: '#/components/schemas/UserSecret' + style: form + requestBody: + $ref: '#/components/requestBodies/ValidatedTradeRequestBody' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/AccountOrderRecord' + description: Status of order placed + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/400FailedRequestResponse' + description: Failed to submit order to broker + x-do-not-generate: true + "500": + description: Unexpected Error + summary: Place order + tags: + - Trading + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-post--trade-tradeId + x-content-type: application/json + x-accepts: application/json + /trade/place: + post: + description: Places a specified trade in the specified account. + operationId: Trading_placeForceOrder + parameters: + - explode: true + in: query + name: userId + required: true + schema: + $ref: '#/components/schemas/UserID' + style: form + - explode: true + in: query + name: userSecret + required: true + schema: + $ref: '#/components/schemas/UserSecret' + style: form + requestBody: + $ref: '#/components/requestBodies/ManualTradeFormRequestBody' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/AccountOrderRecord' + description: Trade sucessfully placed + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/400FailedRequestResponse' + description: Trade could not be placed + x-do-not-generate: true + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/403FailedRequestResponse' + description: User does not have permissions to place trades + x-do-not-generate: true + "500": + description: Unexpected Error + summary: Place a trade with NO validation. + tags: + - Trading + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-post--trade-place + x-content-type: application/json + x-accepts: application/json + /accounts/{accountId}/orders/cancel: + post: + description: | + Sends a signal to the brokerage to cancel the specified order. + This will only work if the order has not yet been executed. + operationId: Trading_cancelUserAccountOrder + parameters: + - explode: true + in: query + name: userId + required: true + schema: + $ref: '#/components/schemas/UserID' + style: form + - explode: true + in: query + name: userSecret + required: true + schema: + $ref: '#/components/schemas/UserSecret' + style: form + - description: The ID of the account to cancel the order in. + explode: false + in: path + name: accountId + required: true + schema: + example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + format: uuid + type: string + x-konfig-original-example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + x-konfig-generated-schema: konfig-generated-schema-paths--accounts-accountId-orders-cancel-post-parameters-2-schema + style: simple + requestBody: + $ref: '#/components/requestBodies/CancelOrderRequestBody' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/AccountOrderRecord' + description: Order Record of canceled order + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/400FailedRequestResponse' + description: Unable to cancel open order. Please verify status in brokerage + account + x-do-not-generate: true + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/500UnexpectedExceptionResponse' + description: Unexpected error + x-do-not-generate: true + summary: Cancel open order in account + tags: + - Trading + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-post--accounts-accountId-orders-cancel + x-content-type: application/json + x-accepts: application/json + /snapTrade/partners: + get: + description: "Returns useful data related to the specified ClientID, including\ + \ allowed brokerages and data access." + operationId: ReferenceData_getPartnerInfo + parameters: [] + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/PartnerData' + description: Successfully obtained encrypted JWT data. See description on + how to object JWT token + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/400FailedRequestResponse' + description: Bad Request + x-do-not-generate: true + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/401FailedRequestResponse' + description: Unauthorized + x-do-not-generate: true + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/404FailedRequestResponse' + description: Not Found + x-do-not-generate: true + "500": + description: Unexpected Error + summary: Get metadata related to Snaptrade partner + tags: + - Reference Data + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-get--snapTrade-partners + x-accepts: application/json + /accounts/{accountId}/symbols: + post: + description: | + Returns a list of universal symbols that are supported by + the specificied account. Returned symbols are based on the + provided search string, matching on ticker and name. + operationId: ReferenceData_symbolSearchUserAccount + parameters: + - explode: true + in: query + name: userId + required: true + schema: + $ref: '#/components/schemas/UserID' + style: form + - explode: true + in: query + name: userSecret + required: true + schema: + $ref: '#/components/schemas/UserSecret' + style: form + - description: The ID of the account to search for symbols within. + explode: false + in: path + name: accountId + required: true + schema: + example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + format: uuid + type: string + x-konfig-original-example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + x-konfig-generated-schema: konfig-generated-schema-paths--accounts-accountId-symbols-post-parameters-2-schema + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SymbolQuery' + responses: + "200": + content: + '*/*': + schema: + items: + $ref: '#/components/schemas/UniversalSymbol' + type: array + x-konfig-is-used-in-successful-response: true + description: List of universal symbol supported by account based on substring + sent it + default: + description: Unexpected error + summary: Search for symbols available in an account + tags: + - Reference Data + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-post--accounts-accountId-symbols + x-content-type: application/json + x-accepts: '*/*' + /accounts/{accountId}/options: + get: + description: | + Returns a list of Options Positions. + operationId: Options_listOptionHoldings + parameters: + - explode: true + in: query + name: userId + required: true + schema: + $ref: '#/components/schemas/UserID' + style: form + - explode: true + in: query + name: userSecret + required: true + schema: + $ref: '#/components/schemas/UserSecret' + style: form + - description: The ID of the account to fetch options holdings for. + explode: false + in: path + name: accountId + required: true + schema: + format: uuid + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/OptionsPosition' + type: array + x-konfig-is-used-in-successful-response: true + description: The option holdings in the account + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/500UnexpectedExceptionResponse' + description: Unexpected error + x-do-not-generate: true + summary: Get account option holdings + tags: + - Options + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-get--accounts-accountId-options + x-accepts: application/json + /accounts/{accountId}/optionsChain: + get: + description: Returns the option chain for the specified symbol in the specified + account. + operationId: Options_getOptionsChain + parameters: + - explode: true + in: query + name: userId + required: true + schema: + $ref: '#/components/schemas/UserID' + style: form + - explode: true + in: query + name: userSecret + required: true + schema: + $ref: '#/components/schemas/UserSecret' + style: form + - description: The ID of the account to get the options chain from. + explode: false + in: path + name: accountId + required: true + schema: + format: uuid + type: string + style: simple + - description: Universal symbol ID if symbol + explode: true + in: query + name: symbol + required: true + schema: + format: uuid + type: string + style: form + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/OptionChain' + description: List of all Options available for the brokerage symbol + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/500UnexpectedExceptionResponse' + description: Unexpected error + x-do-not-generate: true + summary: Get the options chain for a symbol + tags: + - Options + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-get--accounts-accountId-optionsChain + x-accepts: application/json + /accounts/{accountId}/optionStrategy: + post: + description: | + Creates an option strategy object that will be used to place an option strategy order. + operationId: Options_getOptionStrategy + parameters: + - explode: true + in: query + name: userId + required: true + schema: + $ref: '#/components/schemas/UserID' + style: form + - explode: true + in: query + name: userSecret + required: true + schema: + $ref: '#/components/schemas/UserSecret' + style: form + - description: The ID of the account to create the option strategy object in. + explode: false + in: path + name: accountId + required: true + schema: + format: uuid + type: string + style: simple + requestBody: + $ref: '#/components/requestBodies/OptionStrategyRequestBody' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/StrategyQuotes' + description: Order Quotes + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/500UnexpectedExceptionResponse' + description: Unexpected error + x-do-not-generate: true + summary: Create options strategy + tags: + - Options + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-post--accounts-accountId-optionStrategy + x-content-type: application/json + x-accepts: application/json + /accounts/{accountId}/optionStrategy/{optionStrategyId}: + get: + description: | + Returns a Strategy Quotes object which has latest market data of the specified option strategy. + operationId: Options_getOptionsStrategyQuote + parameters: + - explode: true + in: query + name: userId + required: true + schema: + $ref: '#/components/schemas/UserID' + style: form + - explode: true + in: query + name: userSecret + required: true + schema: + $ref: '#/components/schemas/UserSecret' + style: form + - description: The ID of the account the strategy will be placed in. + explode: false + in: path + name: accountId + required: true + schema: + format: uuid + type: string + style: simple + - description: Option strategy id obtained from response when creating option + strategy object + explode: false + in: path + name: optionStrategyId + required: true + schema: + $ref: '#/components/schemas/Id' + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/StrategyQuotes' + description: Order Quotes + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/500UnexpectedExceptionResponse' + description: Unexpected error + x-do-not-generate: true + summary: Get options strategy quotes + tags: + - Options + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-get--accounts-accountId-optionStrategy-optionStrategyId + x-accepts: application/json + /accounts/{accountId}/optionStrategy/{optionStrategyId}/execute: + post: + description: Places the option strategy order and returns the order record received + from the brokerage. + operationId: Options_placeOptionStrategy + parameters: + - explode: true + in: query + name: userId + required: true + schema: + $ref: '#/components/schemas/UserID' + style: form + - explode: true + in: query + name: userSecret + required: true + schema: + $ref: '#/components/schemas/UserSecret' + style: form + - description: The ID of the account to execute the strategy in. + explode: false + in: path + name: accountId + required: true + schema: + $ref: '#/components/schemas/Id' + style: simple + - description: Option strategy id obtained from response when creating option + strategy object + explode: false + in: path + name: optionStrategyId + required: true + schema: + $ref: '#/components/schemas/Id' + style: simple + requestBody: + $ref: '#/components/requestBodies/OrderStrategyExecuteBody' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/StrategyOrderRecord' + description: Status of strategy order placed + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/500UnexpectedExceptionResponse' + description: Unexpected error + x-do-not-generate: true + summary: Place an option strategy order + tags: + - Options + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-post--accounts-accountId-optionStrategy-optionStrategyId-execute + x-content-type: application/json + x-accepts: application/json + /brokerages: + get: + description: Returns a list of all defined Brokerage objects. + operationId: ReferenceData_listAllBrokerages + parameters: [] + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Brokerage' + type: array + x-konfig-is-used-in-successful-response: true + description: A list of all defined Brokerage objects. + default: + description: Unexpected error. + summary: Get brokerages + tags: + - Reference Data + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-get--brokerages + x-accepts: application/json + /brokerageAuthorizationTypes: + get: + description: Returns a list of all defined Brokerage authorization Type objects. + operationId: ReferenceData_listAllBrokerageAuthorizationType + parameters: + - description: Comma separated value of brokerage slugs + explode: true + in: query + name: brokerage + required: false + schema: + example: "QUESTRADE,ALPACA" + type: string + x-konfig-original-example: "QUESTRADE,ALPACA" + x-konfig-generated-schema: konfig-generated-schema-paths--brokerageAuthorizationTypes-get-parameters-0-schema + style: form + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/BrokerageAuthorizationTypeReadOnly' + type: array + x-konfig-is-used-in-successful-response: true + description: A list of all defined Brokerage Authorization Type objects. + default: + description: Unexpected error. + summary: Get all brokerage authorization types + tags: + - Reference Data + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-get--brokerageAuthorizationTypes + x-accepts: application/json + /currencies: + get: + description: Returns a list of all defined Currency objects. + operationId: ReferenceData_listAllCurrencies + parameters: [] + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Currency' + type: array + x-konfig-is-used-in-successful-response: true + description: A list of all currencies. + default: + description: Unexpected error. + summary: Get currencies + tags: + - Reference Data + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-get--currencies + x-accepts: application/json + /currencies/rates: + get: + description: Returns a list of all Exchange Rate Pairs for all supported Currencies. + operationId: ReferenceData_listAllCurrenciesRates + parameters: [] + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/ExchangeRatePairs' + type: array + x-konfig-is-used-in-successful-response: true + description: A list of all exchange rates pairs for supported currencies + summary: Get currency exchange rates + tags: + - Reference Data + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-get--currencies-rates + x-accepts: application/json + /currencies/rates/{currencyPair}: + get: + description: Returns an Exchange Rate Pair object for the specified Currency + Pair. + operationId: ReferenceData_getCurrencyExchangeRatePair + parameters: + - description: "A currency pair based on currency code for example, {CAD-USD}" + explode: false + in: path + name: currencyPair + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ExchangeRatePairs' + description: A list of all exchange rates pairs for supported currencies + summary: Get exchange rate of a currency pair + tags: + - Reference Data + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-get--currencies-rates-currencyPair + x-accepts: application/json + /exchanges: + get: + description: Returns a list of all supported Exchanges. + operationId: ReferenceData_getStockExchanges + parameters: [] + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Exchange' + type: array + x-konfig-is-used-in-successful-response: true + description: A list of all supported stock exchanges + summary: Get exchanges + tags: + - Reference Data + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-get--exchanges + x-accepts: application/json + /securityTypes: + get: + description: List security types available on SnapTrade. + operationId: ReferenceData_getSecurityTypes + parameters: [] + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/SecurityType' + type: array + x-konfig-is-used-in-successful-response: true + description: A list of all defined Security Type objects. + default: + description: Unexpected error. + summary: List of all security types + tags: + - Reference Data + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-get--securityTypes + x-accepts: application/json + /symbols: + post: + description: | + Returns a list of Universal Symbol objects that match a defined string. + + Matches on ticker or name. + operationId: ReferenceData_getSymbols + parameters: [] + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SymbolQuery' + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/UniversalSymbol' + type: array + x-konfig-is-used-in-successful-response: true + description: A list of UniversalSymbol objects which match the specified + substring + default: + description: Unexpected error. + summary: Search for symbols + tags: + - Reference Data + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-post--symbols + x-content-type: application/json + x-accepts: application/json + /symbols/{query}: + get: + description: Returns the Universal Symbol object specified by the ticker or + the universal_symbol_id. + operationId: ReferenceData_getSymbolsByTicker + parameters: + - description: The ticker or universal_symbol_id of the UniversalSymbol to get. + explode: false + in: path + name: query + required: true + schema: + type: string + style: simple + responses: + "200": + content: + '*/*': + schema: + $ref: '#/components/schemas/UniversalSymbol' + description: Successfully gets a symbol + "404": + description: No symbol with the specified ticker found. + default: + description: Unexpected error + summary: Get details of a symbol + tags: + - Reference Data + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-get--symbols-query + x-accepts: '*/*' + /activities: + get: + description: Returns activities (transactions) for a user. Specifying start + and end date is highly recommended for better performance + operationId: TransactionsAndReporting_getActivities + parameters: + - explode: true + in: query + name: startDate + required: false + schema: + $ref: '#/components/schemas/ReportingDate' + style: form + - explode: true + in: query + name: endDate + required: false + schema: + $ref: '#/components/schemas/ReportingDate' + style: form + - description: Optional comma seperated list of account IDs used to filter the + request on specific accounts + explode: true + in: query + name: accounts + required: false + schema: + $ref: '#/components/schemas/AccountIDs' + style: form + - description: Optional comma seperated list of brokerage authorization IDs + used to filter the request on only accounts that belong to those authorizations + explode: true + in: query + name: brokerageAuthorizations + required: false + schema: + $ref: '#/components/schemas/BrokerageAuthIDs' + style: form + - description: "Optional comma seperated list of types to filter activities\ + \ by. This is not an exhaustive list, if we fail to match to these types,\ + \ we will return the raw description from the brokerage. Potential values\ + \ include - DIVIDEND - BUY - SELL - CONTRIBUTION - WITHDRAWAL - EXTERNAL_ASSET_TRANSFER_IN\ + \ - EXTERNAL_ASSET_TRANSFER_OUT - INTERNAL_CASH_TRANSFER_IN - INTERNAL_CASH_TRANSFER_OUT\ + \ - INTERNAL_ASSET_TRANSFER_IN - INTERNAL_ASSET_TRANSFER_OUT - INTEREST\ + \ - REBATE - GOV_GRANT - TAX - FEE - REI - FXT" + explode: true + in: query + name: type + required: false + schema: + example: DIVIDEND + type: string + x-konfig-original-example: DIVIDEND + x-konfig-generated-schema: konfig-generated-schema-paths--activities-get-parameters-4-schema + style: form + - explode: true + in: query + name: userId + required: true + schema: + $ref: '#/components/schemas/UserID' + style: form + - explode: true + in: query + name: userSecret + required: true + schema: + $ref: '#/components/schemas/UserSecret' + style: form + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/UniversalActivity' + type: array + x-konfig-is-used-in-successful-response: true + description: Successfully retrieved transaction history + default: + description: Unexpected error + summary: Get transaction history for a user + tags: + - Transactions And Reporting + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-get--activities + x-accepts: application/json + /performance/custom: + get: + deprecated: true + description: "Returns performance information (contributions, dividends, rate\ + \ of return, etc) for a specific timeframe. Please note that Total Equity\ + \ Timeframe and Rate of Returns are experimental features. Please contact\ + \ support@snaptrade.com if you notice any inconsistencies." + operationId: TransactionsAndReporting_getReportingCustomRange + parameters: + - explode: true + in: query + name: startDate + required: true + schema: + $ref: '#/components/schemas/ReportingDate' + style: form + - explode: true + in: query + name: endDate + required: true + schema: + $ref: '#/components/schemas/ReportingDate' + style: form + - description: Optional comma seperated list of account IDs used to filter the + request on specific accounts + explode: true + in: query + name: accounts + required: false + schema: + $ref: '#/components/schemas/AccountIDs' + style: form + - description: "Optional, increases frequency of data points for the total value\ + \ and contribution charts if set to true" + explode: true + in: query + name: detailed + required: false + schema: + example: true + type: boolean + x-konfig-original-example: true + x-konfig-generated-schema: konfig-generated-schema-paths--performance-custom-get-parameters-3-schema + style: form + - description: "Optional frequency for the rate of return chart (defaults to\ + \ monthly). Possible values are daily, weekly, monthly, quarterly, yearly." + explode: true + in: query + name: frequency + required: false + schema: + $ref: '#/components/schemas/ReportingFrequency' + style: form + - explode: true + in: query + name: userId + required: true + schema: + $ref: '#/components/schemas/UserID' + style: form + - explode: true + in: query + name: userSecret + required: true + schema: + $ref: '#/components/schemas/UserSecret' + style: form + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/PerformanceCustom' + description: Successfully retrieved performance data + default: + description: Unexpected error + summary: Get performance information for a specific timeframe + tags: + - Transactions And Reporting + x-konfig-operation-can-have-single-parameter: true + x-konfig-single-parameter-schema: konfig-generated-schema-single-parameter-schema-get--performance-custom + x-accepts: application/json +components: + requestBodies: + RegisterUserRequestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SnapTradeRegisterUserRequestBody' + required: true + ResetUserSecretRequestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UserIDandSecret' + required: true + SnapTradeLoginUserRequestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SnapTradeLoginUserRequestBody' + LoginRequestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UserIDandSecret' + required: true + DeleteUserRequestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UserIDandSecret' + required: true + RedeemTokenRequestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RedirectTokenandPin' + required: true + PortfolioGroup: + content: + application/json: + schema: + $ref: '#/components/schemas/PortfolioGroup' + required: true + TargetAsset: + content: + application/json: + schema: + $ref: '#/components/schemas/TargetAsset' + required: true + ManualTradeFormRequestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ManualTradeForm' + required: true + ValidatedTradeRequestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ValidatedTradeBody' + required: false + CancelOrderRequestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Trading_cancelUserAccountOrder_request' + description: The Order ID to be canceled + required: true + OptionStrategyRequestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Options_getOptionStrategy_request' + required: true + OrderStrategyExecuteBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Options_placeOptionStrategy_request' + required: true + SnapTradeAPIDisclaimerAcceptRequestBody: + content: + application/json: + schema: + additionalProperties: true + properties: + accepted: + description: A boolean that indicates whether this user has accepted + the disclaimer or not. + type: boolean + type: object + required: true + schemas: + "400FailedRequestResponse": + additionalProperties: true + description: Example for failed request response + properties: + default_detail: + example: Unable to verify data sent + x-konfig-original-example: Unable to verify data sent + default_code: + example: 1076 + x-konfig-original-example: 1076 + type: object + x-konfig-is-used-in-non-successful-response: true + x-do-not-generate: true + "401FailedRequestResponse": + additionalProperties: true + description: Example for failed request response + properties: + default_detail: + example: Unable to verify signature sent + x-konfig-original-example: Unable to verify signature sent + default_code: + example: 1076 + x-konfig-original-example: 1076 + type: object + x-konfig-is-used-in-non-successful-response: true + x-do-not-generate: true + "402BrokerageAuthDisabledResponse": + additionalProperties: true + description: Cannot perform action because connection is disabled + properties: + detail: + example: Unable to sync with brokerage account because the connection is + disabled. + x-konfig-original-example: Unable to sync with brokerage account because + the connection is disabled. + code: + example: 3003 + x-konfig-original-example: 3003 + type: object + x-konfig-is-used-in-non-successful-response: true + x-do-not-generate: true + "402BrokerageAuthAlreadyDisabledException": + additionalProperties: true + description: This connection is already disabled. + properties: + detail: + example: This connection is already disabled. + x-konfig-original-example: This connection is already disabled. + code: + example: 3011 + x-konfig-original-example: 3011 + type: object + x-konfig-is-used-in-non-successful-response: true + x-do-not-generate: true + "403FailedRequestResponse": + additionalProperties: true + description: Example for failed request response + properties: + default_detail: + example: User does not have permission to access this resource + x-konfig-original-example: User does not have permission to access this + resource + default_code: + example: 1066 + x-konfig-original-example: 1066 + type: object + x-konfig-is-used-in-non-successful-response: true + x-do-not-generate: true + "403FeatureNotEnabledResponse": + additionalProperties: true + description: Example for failed request response + properties: + detail: + example: Feature is not enabled for this customer or this connection + x-konfig-original-example: Feature is not enabled for this customer or this + connection + default_code: + example: 1141 + x-konfig-original-example: 1141 + type: object + x-konfig-is-used-in-non-successful-response: true + x-do-not-generate: true + "404FailedRequestResponse": + additionalProperties: true + description: Example for failed request response + properties: + default_detail: + example: The requested resource does not exist. + x-konfig-original-example: The requested resource does not exist. + default_code: + example: 1011 + x-konfig-original-example: 1011 + type: object + x-konfig-is-used-in-non-successful-response: true + x-do-not-generate: true + "500UnexpectedExceptionResponse": + additionalProperties: true + description: Example for a response that failed for unexpected reasons + properties: + detail: + example: Encountered an unexpected exception. + x-konfig-original-example: Encountered an unexpected exception. + status_code: + example: 500 + x-konfig-original-example: 500 + code: + example: 1000 + x-konfig-original-example: 1000 + type: object + x-konfig-is-used-in-non-successful-response: true + x-do-not-generate: true + CashRestriction: + additionalProperties: true + description: Cash restriction rules that apply to this account when undergoing + portfolio rebalance calculations. + example: + amount: 100 + currency: 2bcd7cc3-e922-4976-bce1-9858296801c3 + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: ALLOCATE_MAX + account: 2bcd7cc3-e922-4976-bce1-9858296801c3 + properties: + id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + account: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + currency: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + type: + enum: + - ALLOCATE_MAX + - RETAIN_MIN + type: string + amount: + example: 100 + type: number + x-konfig-original-example: 100 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-CashRestriction-properties-amount + type: object + AccountSyncStatus: + description: Status of account + example: + holdings: + last_successful_sync: 2024-06-28 18:42:46.561408+00:00 + initial_sync_completed: true + transactions: + last_successful_sync: 2022-01-24T00:00:00.000+00:00 + initial_sync_completed: true + first_transaction_date: 2022-01-24T00:00:00.000+00:00 + properties: + transactions: + $ref: '#/components/schemas/TransactionsStatus' + holdings: + $ref: '#/components/schemas/HoldingsStatus' + TransactionsStatus: + description: Status of account transaction sync + example: + last_successful_sync: 2022-01-24T00:00:00.000+00:00 + initial_sync_completed: true + first_transaction_date: 2022-01-24T00:00:00.000+00:00 + properties: + initial_sync_completed: + type: boolean + last_successful_sync: + description: Date in YYYY-MM-DD format or null + example: 2022-01-24 + format: date + nullable: true + type: string + x-konfig-original-example: 2022-01-24 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SyncStatusDate + first_transaction_date: + description: Date in YYYY-MM-DD format or null + example: 2022-01-24 + format: date + nullable: true + type: string + x-konfig-original-example: 2022-01-24 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SyncStatusDate + HoldingsStatus: + description: Status of account holdings sync + example: + last_successful_sync: 2024-06-28 18:42:46.561408+00:00 + initial_sync_completed: true + properties: + initial_sync_completed: + type: boolean + last_successful_sync: + description: Date in ISO 8601 format or null (YYYY-MM-DD HH:MM:SS.mmmmmmTZ) + example: 2024-06-28 18:42:46.561408+00:00 + format: datetime + nullable: true + type: string + x-konfig-original-example: 2024-06-28 18:42:46.561408+00:00 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-HoldingsSyncStatusDate + AccountBalance: + description: Contains balance related information for the account. + example: + total: + amount: 15363.23 + currency: USD + properties: + total: + $ref: '#/components/schemas/AmountNullable' + Amount: + description: "Total value of the account, as reported by the brokerage" + properties: + amount: + description: Total value denominated in the currency of the `currency` field. + example: 15363.23 + type: number + x-konfig-original-example: 15363.23 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Amount-properties-amount + currency: + description: The ISO-4217 currency code for the amount. + example: USD + type: string + x-konfig-original-example: USD + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Amount-properties-currency + Account: + additionalProperties: true + description: SnapTradeUser Investment Account + example: + number: Q6542138443 + balance: + total: + amount: 15363.23 + currency: USD + brokerage_authorization: 2bcd7cc3-e922-4976-bce1-9858296801c3 + meta: + type: Margin + status: ACTIVE + institution_name: Alpaca + name: Registered Retirement Savings Account + sync_status: + holdings: + last_successful_sync: 2024-06-28 18:42:46.561408+00:00 + initial_sync_completed: true + transactions: + last_successful_sync: 2022-01-24T00:00:00.000+00:00 + initial_sync_completed: true + first_transaction_date: 2022-01-24T00:00:00.000+00:00 + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + portfolio_group: 2bcd7cc3-e922-4976-bce1-9858296801c3 + created_date: 2021-06-04T16:26:46.523Z + institution_name: Alpaca + cash_restrictions: + - amount: 100 + currency: 2bcd7cc3-e922-4976-bce1-9858296801c3 + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: ALLOCATE_MAX + account: 2bcd7cc3-e922-4976-bce1-9858296801c3 + - amount: 100 + currency: 2bcd7cc3-e922-4976-bce1-9858296801c3 + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: ALLOCATE_MAX + account: 2bcd7cc3-e922-4976-bce1-9858296801c3 + properties: + id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + brokerage_authorization: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + portfolio_group: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + name: + example: Registered Retirement Savings Account + type: string + x-konfig-original-example: Registered Retirement Savings Account + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Account-properties-name + number: + example: Q6542138443 + type: string + x-konfig-original-example: Q6542138443 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Account-properties-number + institution_name: + example: Alpaca + type: string + x-konfig-original-example: Alpaca + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Account-properties-institution_name + created_date: + example: 2021-06-04T16:26:46.523Z + type: string + x-konfig-original-example: 2021-06-04T16:26:46.523Z + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Account-properties-created_date + meta: + additionalProperties: true + example: + type: Margin + status: ACTIVE + institution_name: Alpaca + type: object + x-konfig-original-example: + type: Margin + status: ACTIVE + institution_name: Alpaca + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Account-properties-meta + cash_restrictions: + items: + $ref: '#/components/schemas/CashRestriction' + type: array + sync_status: + $ref: '#/components/schemas/AccountSyncStatus' + balance: + $ref: '#/components/schemas/AccountBalance' + type: object + x-konfig-is-used-in-successful-response: true + AccountSimple: + additionalProperties: true + description: SnapTradeUser Investment Account + example: + number: Q6542138443 + name: Registered Retirement Savings Account + sync_status: + holdings: + last_successful_sync: 2024-06-28 18:42:46.561408+00:00 + initial_sync_completed: true + transactions: + last_successful_sync: 2022-01-24T00:00:00.000+00:00 + initial_sync_completed: true + first_transaction_date: 2022-01-24T00:00:00.000+00:00 + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + properties: + id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + name: + example: Registered Retirement Savings Account + type: string + x-konfig-original-example: Registered Retirement Savings Account + x-konfig-generated-schema: konfig-generated-schema-components-schemas-AccountSimple-properties-name + number: + example: Q6542138443 + type: string + x-konfig-original-example: Q6542138443 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-AccountSimple-properties-number + sync_status: + $ref: '#/components/schemas/AccountSyncStatus' + type: object + AccountID: + description: Unique identifier for the connected brokerage account. This is + the UUID used to reference the account in SnapTrade. + example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + format: uuid + type: string + x-konfig-original-example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-AccountID + AccountIDs: + description: Comma seperated list of account IDs + example: "917c8734-8470-4a3e-a18f-57c3f2ee6631,65e839a3-9103-4cfb-9b72-2071ef80c5f2" + type: string + x-konfig-original-example: "917c8734-8470-4a3e-a18f-57c3f2ee6631,65e839a3-9103-4cfb-9b72-2071ef80c5f2" + x-konfig-generated-schema: konfig-generated-schema-components-schemas-AccountIDs + BrokerageAuthID: + description: Unique identifier for the connection (brokerage authorization). + This is the UUID used to reference the connection in SnapTrade. + example: 87b24961-b51e-4db8-9226-f198f6518a89 + format: uuid + type: string + x-konfig-original-example: 87b24961-b51e-4db8-9226-f198f6518a89 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-BrokerageAuthID + BrokerageAuthIDs: + description: Comma seperated list of brokerage authorization IDs + example: "917c8734-8470-4a3e-a18f-57c3f2ee6631,65e839a3-9103-4cfb-9b72-2071ef80c5f2" + type: string + x-konfig-original-example: "917c8734-8470-4a3e-a18f-57c3f2ee6631,65e839a3-9103-4cfb-9b72-2071ef80c5f2" + x-konfig-generated-schema: konfig-generated-schema-components-schemas-BrokerageAuthIDs + AccountHoldings: + additionalProperties: true + description: Account Holdings + example: + total_value: + currency: USD + value: 32600.71 + balances: + - currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + cash: 300.71 + buying_power: 410.71 + - currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + cash: 300.71 + buying_power: 410.71 + positions: + - symbol: + is_quotable: true + symbol: + figi_code: BBG000B9XRY4 + symbol: VAB.TO + figi_instrument: + figi_code: BBG000B9Y5X2 + figi_share_class: BBG001S5N8V8 + raw_symbol: VAB + description: VANGUARD CDN AGGREGATE BOND INDEX ETF + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + exchange: + start_time: 09:30:00 + mic_code: XTSE + code: TSX + timezone: America/New_York + name: Toronto Stock Exchange + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + close_time: "57600" + suffix: .TO + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: + is_supported: true + code: cs + description: Common Stock + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + currencies: + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + is_tradable: true + local_id: "3291231" + description: VANGUARD CDN AGGREGATE BOND INDEX ETF + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + fractional_units: 1.44 + price: 113.15 + open_pnl: 0.44 + units: 40 + average_purchase_price: 108.3353 + - symbol: + is_quotable: true + symbol: + figi_code: BBG000B9XRY4 + symbol: VAB.TO + figi_instrument: + figi_code: BBG000B9Y5X2 + figi_share_class: BBG001S5N8V8 + raw_symbol: VAB + description: VANGUARD CDN AGGREGATE BOND INDEX ETF + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + exchange: + start_time: 09:30:00 + mic_code: XTSE + code: TSX + timezone: America/New_York + name: Toronto Stock Exchange + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + close_time: "57600" + suffix: .TO + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: + is_supported: true + code: cs + description: Common Stock + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + currencies: + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + is_tradable: true + local_id: "3291231" + description: VANGUARD CDN AGGREGATE BOND INDEX ETF + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + fractional_units: 1.44 + price: 113.15 + open_pnl: 0.44 + units: 40 + average_purchase_price: 108.3353 + account: + number: Q6542138443 + brokerage_authorization: + brokerage: + maintenance_mode: true + allows_fractional_units: true + exchanges: + - 2bcd7cc3-e922-4976-bce1-9858296801c3 + - 4bcd8cc3-c122-4974-dc21-1858296801f4 + description: Questrade is an online brokerage firm and wealth management + firm based in Canada. It is Canada's largest discount broker. + open_url: https://www.brokerage.com + display_name: Questrade + url: https://www.questrade.com/ + enabled: true + allows_trading: true + has_reporting: true + aws_s3_square_logo_url: https://www.snaptrade.com/questrade.logo + is_real_time_connection: true + name: Questrade + allows_trading_through_snaptrade_api: true + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + default_currency: 2bcd7cc3-e922-4976-bce1-9858296801c3 + brokerage_type: + name: Traditional Brokerage + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + aws_s3_logo_url: https://www.snaptrade.com/questrade.logo + slug: QUESTRADE + is_scraping_integration: true + disabled_date: 2022-01-21T20:11:19.217Z + meta: + identifier: 123456 + name: Connection-1 + disabled: false + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + created_date: 2022-01-21T20:11:19.217Z + updated_date: 2022-01-21T20:11:19.217Z + type: trade + meta: + type: Margin + status: ACTIVE + institution_name: Alpaca + name: Registered Retirement Savings Account + sync_status: + holdings: + last_successful_sync: 2024-06-28 18:42:46.561408+00:00 + initial_sync_completed: true + transactions: + last_successful_sync: 2022-01-24T00:00:00.000+00:00 + initial_sync_completed: true + first_transaction_date: 2022-01-24T00:00:00.000+00:00 + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + portfolio_group: 2bcd7cc3-e922-4976-bce1-9858296801c3 + institution_name: Alpaca + properties: + account: + $ref: '#/components/schemas/SnapTradeHoldingsAccount' + balances: + items: + $ref: '#/components/schemas/Balance' + nullable: true + type: array + positions: + items: + $ref: '#/components/schemas/Position' + nullable: true + type: array + total_value: + $ref: '#/components/schemas/SnapTradeHoldingsTotalValue' + type: object + AccountHoldingsAccount: + additionalProperties: true + description: A wrapper object containing holdings information for a single account + example: + total_value: + currency: USD + value: 32600.71 + balances: + - currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + cash: 300.71 + buying_power: 410.71 + - currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + cash: 300.71 + buying_power: 410.71 + option_positions: + - symbol: + description: SPY CALL 7/17 200 + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + option_symbol: + ticker: SPY 220819P00200000 + exchange_id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 + local_id: "40817960" + is_mini_option: false + option_type: CALL + underlying_symbol: + figi_code: BBG000B9XRY4 + symbol: SPY + figi_instrument: + figi_code: BBG000B9Y5X2 + figi_share_class: BBG001S5N8V8 + description: SPDR S&P 500 ETF Trust + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + exchange: + start_time: 09:30:00 + mic_code: ARCA + code: ARCX + timezone: America/New_York + name: NYSE ARCA + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + close_time: "57600" + suffix: None + allows_cryptocurrency_symbols: false + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: + is_supported: true + code: cs + description: Common Stock + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + currencies: + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + expiration_date: 2017-07-17T15:13:07.177712+00:00 + strike_price: 200 + price: 113.15 + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + units: 10 + average_purchase_price: 108.3353 + - symbol: + description: SPY CALL 7/17 200 + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + option_symbol: + ticker: SPY 220819P00200000 + exchange_id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 + local_id: "40817960" + is_mini_option: false + option_type: CALL + underlying_symbol: + figi_code: BBG000B9XRY4 + symbol: SPY + figi_instrument: + figi_code: BBG000B9Y5X2 + figi_share_class: BBG001S5N8V8 + description: SPDR S&P 500 ETF Trust + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + exchange: + start_time: 09:30:00 + mic_code: ARCA + code: ARCX + timezone: America/New_York + name: NYSE ARCA + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + close_time: "57600" + suffix: None + allows_cryptocurrency_symbols: false + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: + is_supported: true + code: cs + description: Common Stock + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + currencies: + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + expiration_date: 2017-07-17T15:13:07.177712+00:00 + strike_price: 200 + price: 113.15 + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + units: 10 + average_purchase_price: 108.3353 + positions: + - symbol: + is_quotable: true + symbol: + figi_code: BBG000B9XRY4 + symbol: VAB.TO + figi_instrument: + figi_code: BBG000B9Y5X2 + figi_share_class: BBG001S5N8V8 + raw_symbol: VAB + description: VANGUARD CDN AGGREGATE BOND INDEX ETF + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + exchange: + start_time: 09:30:00 + mic_code: XTSE + code: TSX + timezone: America/New_York + name: Toronto Stock Exchange + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + close_time: "57600" + suffix: .TO + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: + is_supported: true + code: cs + description: Common Stock + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + currencies: + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + is_tradable: true + local_id: "3291231" + description: VANGUARD CDN AGGREGATE BOND INDEX ETF + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + fractional_units: 1.44 + price: 113.15 + open_pnl: 0.44 + units: 40 + average_purchase_price: 108.3353 + - symbol: + is_quotable: true + symbol: + figi_code: BBG000B9XRY4 + symbol: VAB.TO + figi_instrument: + figi_code: BBG000B9Y5X2 + figi_share_class: BBG001S5N8V8 + raw_symbol: VAB + description: VANGUARD CDN AGGREGATE BOND INDEX ETF + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + exchange: + start_time: 09:30:00 + mic_code: XTSE + code: TSX + timezone: America/New_York + name: Toronto Stock Exchange + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + close_time: "57600" + suffix: .TO + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: + is_supported: true + code: cs + description: Common Stock + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + currencies: + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + is_tradable: true + local_id: "3291231" + description: VANGUARD CDN AGGREGATE BOND INDEX ETF + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + fractional_units: 1.44 + price: 113.15 + open_pnl: 0.44 + units: 40 + average_purchase_price: 108.3353 + orders: + - symbol: 2bcd7cc3-e922-4976-bce1-9858296801c3 + time_executed: 2022-01-21T20:11:19.217Z + time_placed: 2022-01-21T20:11:19.217Z + expiry_date: 2022-01-21T20:11:19.217Z + brokerage_order_id: brokerage_order_id + limit_price: 31.33 + time_updated: 2022-01-21T20:11:19.217Z + canceled_quantity: 1.4658129805029452 + time_in_force: time_in_force + execution_price: 31.33 + stop_price: 31.33 + action: action + total_quantity: 0.8008281904610115 + universal_symbol: + figi_code: BBG000B9XRY4 + symbol: VAB.TO + figi_instrument: + figi_code: BBG000B9Y5X2 + figi_share_class: BBG001S5N8V8 + raw_symbol: VAB + description: VANGUARD CDN AGGREGATE BOND INDEX ETF + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + exchange: + start_time: 09:30:00 + mic_code: XTSE + code: TSX + timezone: America/New_York + name: Toronto Stock Exchange + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + close_time: "57600" + suffix: .TO + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: + is_supported: true + code: cs + description: Common Stock + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + currencies: + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + filled_quantity: 5.962133916683182 + option_symbol: + ticker: SPY 220819P00200000 + exchange_id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 + local_id: "40817960" + is_mini_option: false + option_type: CALL + underlying_symbol: + figi_code: BBG000B9XRY4 + symbol: SPY + figi_instrument: + figi_code: BBG000B9Y5X2 + figi_share_class: BBG001S5N8V8 + description: SPDR S&P 500 ETF Trust + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + exchange: + start_time: 09:30:00 + mic_code: ARCA + code: ARCX + timezone: America/New_York + name: NYSE ARCA + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + close_time: "57600" + suffix: None + allows_cryptocurrency_symbols: false + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: + is_supported: true + code: cs + description: Common Stock + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + currencies: + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + expiration_date: 2017-07-17T15:13:07.177712+00:00 + strike_price: 200 + order_type: order_type + open_quantity: 6.027456183070403 + status: null + - symbol: 2bcd7cc3-e922-4976-bce1-9858296801c3 + time_executed: 2022-01-21T20:11:19.217Z + time_placed: 2022-01-21T20:11:19.217Z + expiry_date: 2022-01-21T20:11:19.217Z + brokerage_order_id: brokerage_order_id + limit_price: 31.33 + time_updated: 2022-01-21T20:11:19.217Z + canceled_quantity: 1.4658129805029452 + time_in_force: time_in_force + execution_price: 31.33 + stop_price: 31.33 + action: action + total_quantity: 0.8008281904610115 + universal_symbol: + figi_code: BBG000B9XRY4 + symbol: VAB.TO + figi_instrument: + figi_code: BBG000B9Y5X2 + figi_share_class: BBG001S5N8V8 + raw_symbol: VAB + description: VANGUARD CDN AGGREGATE BOND INDEX ETF + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + exchange: + start_time: 09:30:00 + mic_code: XTSE + code: TSX + timezone: America/New_York + name: Toronto Stock Exchange + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + close_time: "57600" + suffix: .TO + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: + is_supported: true + code: cs + description: Common Stock + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + currencies: + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + filled_quantity: 5.962133916683182 + option_symbol: + ticker: SPY 220819P00200000 + exchange_id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 + local_id: "40817960" + is_mini_option: false + option_type: CALL + underlying_symbol: + figi_code: BBG000B9XRY4 + symbol: SPY + figi_instrument: + figi_code: BBG000B9Y5X2 + figi_share_class: BBG001S5N8V8 + description: SPDR S&P 500 ETF Trust + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + exchange: + start_time: 09:30:00 + mic_code: ARCA + code: ARCX + timezone: America/New_York + name: NYSE ARCA + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + close_time: "57600" + suffix: None + allows_cryptocurrency_symbols: false + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: + is_supported: true + code: cs + description: Common Stock + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + currencies: + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + expiration_date: 2017-07-17T15:13:07.177712+00:00 + strike_price: 200 + order_type: order_type + open_quantity: 6.027456183070403 + status: null + account: + number: Q6542138443 + balance: + total: + amount: 15363.23 + currency: USD + brokerage_authorization: 87b24961-b51e-4db8-9226-f198f6518a89 + meta: + type: Margin + status: ACTIVE + institution_name: Alpaca + name: Robinhood Individual + id: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + portfolio_group: 2bcd7cc3-e922-4976-bce1-9858296801c3 + created_date: 2024-07-23T22:50:22.761Z + institution_name: Alpaca + cash_restrictions: + - amount: 100 + currency: 2bcd7cc3-e922-4976-bce1-9858296801c3 + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: ALLOCATE_MAX + account: 2bcd7cc3-e922-4976-bce1-9858296801c3 + - amount: 100 + currency: 2bcd7cc3-e922-4976-bce1-9858296801c3 + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: ALLOCATE_MAX + account: 2bcd7cc3-e922-4976-bce1-9858296801c3 + properties: + account: + $ref: '#/components/schemas/SnapTradeHoldingsAccountAccountId' + balances: + description: "List of balances for the account. Each element of the list\ + \ has a distinct currency. Some brokerages like Questrade [allows holding\ + \ multiple currencies in the same account](https://www.questrade.com/learning/questrade-basics/balances-and-reports/understanding-your-account-balances)." + items: + $ref: '#/components/schemas/Balance' + nullable: true + type: array + positions: + description: List of stock/ETF/crypto/mutual fund positions in the account. + items: + $ref: '#/components/schemas/Position' + nullable: true + type: array + option_positions: + description: List of option positions in the account. + items: + $ref: '#/components/schemas/OptionsPosition' + nullable: true + type: array + orders: + description: "List of recent orders in the account, including both pending\ + \ and executed orders." + items: + $ref: '#/components/schemas/AccountOrderRecord' + nullable: true + type: array + total_value: + $ref: '#/components/schemas/SnapTradeHoldingsTotalValue' + type: object + x-konfig-is-used-in-successful-response: true + AccountOrderRecord: + additionalProperties: true + description: Record of order in brokerageaccount + example: + symbol: 2bcd7cc3-e922-4976-bce1-9858296801c3 + time_executed: 2022-01-21T20:11:19.217Z + time_placed: 2022-01-21T20:11:19.217Z + expiry_date: 2022-01-21T20:11:19.217Z + brokerage_order_id: brokerage_order_id + limit_price: 31.33 + time_updated: 2022-01-21T20:11:19.217Z + canceled_quantity: 1.4658129805029452 + time_in_force: time_in_force + execution_price: 31.33 + stop_price: 31.33 + action: action + total_quantity: 0.8008281904610115 + universal_symbol: + figi_code: BBG000B9XRY4 + symbol: VAB.TO + figi_instrument: + figi_code: BBG000B9Y5X2 + figi_share_class: BBG001S5N8V8 + raw_symbol: VAB + description: VANGUARD CDN AGGREGATE BOND INDEX ETF + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + exchange: + start_time: 09:30:00 + mic_code: XTSE + code: TSX + timezone: America/New_York + name: Toronto Stock Exchange + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + close_time: "57600" + suffix: .TO + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: + is_supported: true + code: cs + description: Common Stock + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + currencies: + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + filled_quantity: 5.962133916683182 + option_symbol: + ticker: SPY 220819P00200000 + exchange_id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 + local_id: "40817960" + is_mini_option: false + option_type: CALL + underlying_symbol: + figi_code: BBG000B9XRY4 + symbol: SPY + figi_instrument: + figi_code: BBG000B9Y5X2 + figi_share_class: BBG001S5N8V8 + description: SPDR S&P 500 ETF Trust + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + exchange: + start_time: 09:30:00 + mic_code: ARCA + code: ARCX + timezone: America/New_York + name: NYSE ARCA + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + close_time: "57600" + suffix: None + allows_cryptocurrency_symbols: false + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: + is_supported: true + code: cs + description: Common Stock + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + currencies: + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + expiration_date: 2017-07-17T15:13:07.177712+00:00 + strike_price: 200 + order_type: order_type + open_quantity: 6.027456183070403 + status: null + properties: + brokerage_order_id: + description: Order id returned by brokerage + type: string + status: + $ref: '#/components/schemas/AccountOrderRecordStatus' + symbol: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + universal_symbol: + $ref: '#/components/schemas/UniversalSymbol' + option_symbol: + $ref: '#/components/schemas/OptionsSymbol' + action: + description: Trade Action potential values include (but are not limited + to) - BUY - SELL - BUY_COVER - SELL_SHORT - BUY_OPEN - BUY_CLOSE - SELL_OPEN + - SELL_CLOSE + type: string + total_quantity: + description: Trade Units. Cannot work with notional value. + nullable: true + type: number + open_quantity: + description: Trade Units + nullable: true + type: number + canceled_quantity: + description: Trade Units + nullable: true + type: number + filled_quantity: + description: Trade Units + nullable: true + type: number + execution_price: + description: Trade Price if limit or stop limit order + example: 31.33 + nullable: true + type: number + x-konfig-original-example: 31.33 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Price + limit_price: + description: Trade Price if limit or stop limit order + example: 31.33 + nullable: true + type: number + x-konfig-original-example: 31.33 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Price + stop_price: + description: "Stop Price. If stop loss or stop limit order, the price to\ + \ trigger the stop" + example: 31.33 + nullable: true + type: number + x-konfig-original-example: 31.33 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StopPrice + order_type: + description: Order Type potential values include (but are not limited to) + - Limit - Market - StopLimit - StopLoss + nullable: true + type: string + time_in_force: + description: | + Trade time in force examples: + * FOK - Fill Or Kill + * Day - Day + * GTC - Good Til Canceled + * GTD - Good Til Date + type: string + time_placed: + description: Time + example: 2022-01-21T20:11:19.217Z + type: string + x-konfig-original-example: 2022-01-21T20:11:19.217Z + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Time + time_updated: + description: Time + example: 2022-01-21T20:11:19.217Z + nullable: true + type: string + x-konfig-original-example: 2022-01-21T20:11:19.217Z + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Time + time_executed: + description: Time + example: 2022-01-21T20:11:19.217Z + nullable: true + type: string + x-konfig-original-example: 2022-01-21T20:11:19.217Z + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Time + expiry_date: + description: Time + example: 2022-01-21T20:11:19.217Z + type: string + x-konfig-original-example: 2022-01-21T20:11:19.217Z + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Time + type: object + x-konfig-is-used-in-successful-response: true + x-konfig-properties: + total_quantity: + nullable: true + time_updated: + nullable: true + AccountOrderRecordStatus: + enum: + - NONE + - PENDING + - ACCEPTED + - FAILED + - REJECTED + - CANCELED + - PARTIAL_CANCELED + - CANCEL_PENDING + - EXECUTED + - PARTIAL + - REPLACE_PENDING + - REPLACED + - STOPPED + - SUSPENDED + - EXPIRED + - QUEUED + - TRIGGERED + - ACTIVATED + - PENDING_RISK_REVIEW + - CONTINGENT_ORDER + type: string + OptionsPosition: + additionalProperties: true + description: Describes a single option position in an account. + example: + symbol: + description: SPY CALL 7/17 200 + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + option_symbol: + ticker: SPY 220819P00200000 + exchange_id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 + local_id: "40817960" + is_mini_option: false + option_type: CALL + underlying_symbol: + figi_code: BBG000B9XRY4 + symbol: SPY + figi_instrument: + figi_code: BBG000B9Y5X2 + figi_share_class: BBG001S5N8V8 + description: SPDR S&P 500 ETF Trust + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + exchange: + start_time: 09:30:00 + mic_code: ARCA + code: ARCX + timezone: America/New_York + name: NYSE ARCA + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + close_time: "57600" + suffix: None + allows_cryptocurrency_symbols: false + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: + is_supported: true + code: cs + description: Common Stock + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + currencies: + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + expiration_date: 2017-07-17T15:13:07.177712+00:00 + strike_price: 200 + price: 113.15 + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + units: 10 + average_purchase_price: 108.3353 + properties: + symbol: + $ref: '#/components/schemas/OptionBrokerageSymbol' + price: + description: "Last known market price for the option contract. The freshness\ + \ of this price depends on the brokerage. Some brokerages provide real-time\ + \ prices, while others provide delayed prices. It is recommended that\ + \ you rely on your own third-party market data provider for most up to\ + \ date prices." + example: 113.15 + nullable: true + type: number + x-konfig-original-example: 113.15 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-OptionsPosition-properties-price + units: + description: The number of contracts for this option position. + example: 10 + type: number + x-konfig-original-example: 10 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-OptionsPosition-properties-units + currency: + $ref: '#/components/schemas/CurrencyNullable' + average_purchase_price: + description: "Cost basis _per contract_ of this option position. To get\ + \ the cost basis _per share_, divide this value by the number of shares\ + \ per contract (usually 100)." + example: 108.3353 + nullable: true + type: number + x-konfig-original-example: 108.3353 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-OptionsPosition-properties-average_purchase_price + type: object + x-konfig-properties: + currency: + nullable: true + StrategyImpact: + additionalProperties: true + description: The strategy impact + properties: + estimatedCommissions: + example: 11.95 + type: number + x-konfig-original-example: 11.95 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyImpact-properties-estimatedCommissions + buyingPowerEffect: + example: -156.3435 + type: number + x-konfig-original-example: -156.3435 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyImpact-properties-buyingPowerEffect + buyingPowerResult: + example: 8800.0882 + type: number + x-konfig-original-example: 8800.0882 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyImpact-properties-buyingPowerResult + maintExcessEffect: + example: -46.95 + type: number + x-konfig-original-example: -46.95 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyImpact-properties-maintExcessEffect + maintExcessResult: + example: 2642.669129 + type: number + x-konfig-original-example: 2642.669129 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyImpact-properties-maintExcessResult + tradeValueCalculation: + example: 1 x 0.07 x 100 + 1 x 0.28 x 100 = DR 35.00 CAD + type: string + x-konfig-original-example: 1 x 0.07 x 100 + 1 x 0.28 x 100 = DR 35.00 CAD + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyImpact-properties-tradeValueCalculation + legs: + items: + $ref: '#/components/schemas/StrategyImpact_legs_inner' + type: array + side: + example: Buy + type: string + x-konfig-original-example: Buy + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyImpact-properties-side + effect: + example: Debit + type: string + x-konfig-original-example: Debit + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyImpact-properties-effect + price: + example: 0.35 + type: number + x-konfig-original-example: 0.35 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyImpact-properties-price + strategy: + example: Strangle + type: string + x-konfig-original-example: Strangle + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyImpact-properties-strategy + type: object + StrategyOrderQuotes: + description: The quotes for the strategy requested + StrategyOrderPlace: + additionalProperties: true + description: The reponse for a correctly placed order + properties: + orderId: + example: 1069605761 + format: int32 + type: integer + x-konfig-original-example: 1069605761 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orderId + orders: + items: + $ref: '#/components/schemas/StrategyOrderPlace_orders_inner' + type: array + type: object + OptionStrategy: + additionalProperties: true + example: + number_of_legs: 2 + legs: + - quantity: 10 + index: 1 + action: BUY_TO_OPEN + option_symbol_id: AAPLC20221111 + - quantity: 10 + index: 1 + action: BUY_TO_OPEN + option_symbol_id: AAPLC20221111 + strategy_type: BUTTERFLY + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + underlying_symbol_id: + figi_code: BBG000B9XRY4 + symbol: VAB.TO + figi_instrument: + figi_code: BBG000B9Y5X2 + figi_share_class: BBG001S5N8V8 + raw_symbol: VAB + description: VANGUARD CDN AGGREGATE BOND INDEX ETF + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + exchange: + start_time: 09:30:00 + mic_code: XTSE + code: TSX + timezone: America/New_York + name: Toronto Stock Exchange + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + close_time: "57600" + suffix: .TO + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: + is_supported: true + code: cs + description: Common Stock + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + currencies: + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + properties: + id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + underlying_symbol_id: + $ref: '#/components/schemas/UniversalSymbol' + strategy_type: + example: BUTTERFLY + type: string + x-konfig-original-example: BUTTERFLY + x-konfig-generated-schema: konfig-generated-schema-components-schemas-OptionStrategy-properties-strategy_type + number_of_legs: + example: 2 + type: number + x-konfig-original-example: 2 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-OptionStrategy-properties-number_of_legs + legs: + items: + $ref: '#/components/schemas/OptionStrategy_legs_inner' + type: array + type: object + StrategyQuotes: + additionalProperties: true + example: + greek: + delta: 0.1 + rho: 0.1 + theta: 0.1 + gamma: 0.1 + vega: 0.1 + volatility: 0.141 + strategy: + number_of_legs: 2 + legs: + - quantity: 10 + index: 1 + action: BUY_TO_OPEN + option_symbol_id: AAPLC20221111 + - quantity: 10 + index: 1 + action: BUY_TO_OPEN + option_symbol_id: AAPLC20221111 + strategy_type: BUTTERFLY + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + underlying_symbol_id: + figi_code: BBG000B9XRY4 + symbol: VAB.TO + figi_instrument: + figi_code: BBG000B9Y5X2 + figi_share_class: BBG001S5N8V8 + raw_symbol: VAB + description: VANGUARD CDN AGGREGATE BOND INDEX ETF + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + exchange: + start_time: 09:30:00 + mic_code: XTSE + code: TSX + timezone: America/New_York + name: Toronto Stock Exchange + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + close_time: "57600" + suffix: .TO + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: + is_supported: true + code: cs + description: Common Stock + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + currencies: + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + open_price: 31.33 + bid_price: 31.33 + ask_price: 31.33 + properties: + strategy: + $ref: '#/components/schemas/OptionStrategy' + open_price: + description: Trade Price if limit or stop limit order + example: 31.33 + nullable: true + type: number + x-konfig-original-example: 31.33 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Price + bid_price: + description: Trade Price if limit or stop limit order + example: 31.33 + nullable: true + type: number + x-konfig-original-example: 31.33 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Price + ask_price: + description: Trade Price if limit or stop limit order + example: 31.33 + nullable: true + type: number + x-konfig-original-example: 31.33 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Price + volatility: + example: 0.141 + type: number + x-konfig-original-example: 0.141 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyQuotes-properties-volatility + greek: + $ref: '#/components/schemas/StrategyQuotes_greek' + type: object + x-konfig-is-used-in-successful-response: true + StrategyOrderRecord: + additionalProperties: true + description: Strategy order record + example: + time_in_force: time_in_force + execution_price: 31.33 + time_placed: 2022-01-21T20:11:19.217Z + strategy: + number_of_legs: 2 + legs: + - quantity: 10 + index: 1 + action: BUY_TO_OPEN + option_symbol_id: AAPLC20221111 + - quantity: 10 + index: 1 + action: BUY_TO_OPEN + option_symbol_id: AAPLC20221111 + strategy_type: BUTTERFLY + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + underlying_symbol_id: + figi_code: BBG000B9XRY4 + symbol: VAB.TO + figi_instrument: + figi_code: BBG000B9Y5X2 + figi_share_class: BBG001S5N8V8 + raw_symbol: VAB + description: VANGUARD CDN AGGREGATE BOND INDEX ETF + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + exchange: + start_time: 09:30:00 + mic_code: XTSE + code: TSX + timezone: America/New_York + name: Toronto Stock Exchange + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + close_time: "57600" + suffix: .TO + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: + is_supported: true + code: cs + description: Common Stock + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + currencies: + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + filled_quantity: 10 + order_type: order_type + limit_price: 31.33 + open_quantity: 10 + closed_quantity: 10 + time_updated: 2022-01-21T20:11:19.217Z + status: PENDING + properties: + strategy: + $ref: '#/components/schemas/OptionStrategy' + status: + enum: + - PENDING + - ACCEPTED + - FAILED + - REJECTED + - CANCELED + - PARTIAL_CANCELED + - CANCEL_PENDING + - EXECUTED + - PARTIAL + - REPLACE_PENDING + - REPLACED + - STOPPED + - SUSPENDED + - EXPIRED + - QUEUED + - TRIGGERED + - ACTIVATED + - PENDING_RISK_REVIEW + - CONTINGENT_ORDER + type: string + filled_quantity: + example: 10 + type: number + x-konfig-original-example: 10 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyOrderRecord-properties-filled_quantity + open_quantity: + example: 10 + type: number + x-konfig-original-example: 10 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyOrderRecord-properties-open_quantity + closed_quantity: + example: 10 + type: number + x-konfig-original-example: 10 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyOrderRecord-properties-closed_quantity + order_type: + description: Order Type potential values include (but are not limited to) + - Limit - Market - StopLimit - StopLoss + nullable: true + type: string + time_in_force: + description: | + Trade time in force examples: + * FOK - Fill Or Kill + * Day - Day + * GTC - Good Til Canceled + * GTD - Good Til Date + type: string + limit_price: + description: Trade Price if limit or stop limit order + example: 31.33 + nullable: true + type: number + x-konfig-original-example: 31.33 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Price + execution_price: + description: Trade Price if limit or stop limit order + example: 31.33 + nullable: true + type: number + x-konfig-original-example: 31.33 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Price + time_placed: + description: Time + example: 2022-01-21T20:11:19.217Z + type: string + x-konfig-original-example: 2022-01-21T20:11:19.217Z + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Time + time_updated: + description: Time + example: 2022-01-21T20:11:19.217Z + type: string + x-konfig-original-example: 2022-01-21T20:11:19.217Z + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Time + type: object + x-konfig-is-used-in-successful-response: true + SnapTradeHoldingsAccount: + additionalProperties: true + description: SnapTradeUser Investment Account + example: + number: Q6542138443 + brokerage_authorization: + brokerage: + maintenance_mode: true + allows_fractional_units: true + exchanges: + - 2bcd7cc3-e922-4976-bce1-9858296801c3 + - 4bcd8cc3-c122-4974-dc21-1858296801f4 + description: Questrade is an online brokerage firm and wealth management + firm based in Canada. It is Canada's largest discount broker. + open_url: https://www.brokerage.com + display_name: Questrade + url: https://www.questrade.com/ + enabled: true + allows_trading: true + has_reporting: true + aws_s3_square_logo_url: https://www.snaptrade.com/questrade.logo + is_real_time_connection: true + name: Questrade + allows_trading_through_snaptrade_api: true + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + default_currency: 2bcd7cc3-e922-4976-bce1-9858296801c3 + brokerage_type: + name: Traditional Brokerage + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + aws_s3_logo_url: https://www.snaptrade.com/questrade.logo + slug: QUESTRADE + is_scraping_integration: true + disabled_date: 2022-01-21T20:11:19.217Z + meta: + identifier: 123456 + name: Connection-1 + disabled: false + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + created_date: 2022-01-21T20:11:19.217Z + updated_date: 2022-01-21T20:11:19.217Z + type: trade + meta: + type: Margin + status: ACTIVE + institution_name: Alpaca + name: Registered Retirement Savings Account + sync_status: + holdings: + last_successful_sync: 2024-06-28 18:42:46.561408+00:00 + initial_sync_completed: true + transactions: + last_successful_sync: 2022-01-24T00:00:00.000+00:00 + initial_sync_completed: true + first_transaction_date: 2022-01-24T00:00:00.000+00:00 + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + portfolio_group: 2bcd7cc3-e922-4976-bce1-9858296801c3 + institution_name: Alpaca + properties: + id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + brokerage_authorization: + $ref: '#/components/schemas/BrokerageAuthorization' + portfolio_group: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + name: + example: Registered Retirement Savings Account + nullable: true + type: string + x-konfig-original-example: Registered Retirement Savings Account + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SnapTradeHoldingsAccount-properties-name + number: + example: Q6542138443 + type: string + x-konfig-original-example: Q6542138443 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SnapTradeHoldingsAccount-properties-number + institution_name: + example: Alpaca + type: string + x-konfig-original-example: Alpaca + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SnapTradeHoldingsAccount-properties-institution_name + sync_status: + $ref: '#/components/schemas/AccountSyncStatus' + meta: + additionalProperties: true + example: + type: Margin + status: ACTIVE + institution_name: Alpaca + type: object + x-konfig-original-example: + type: Margin + status: ACTIVE + institution_name: Alpaca + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SnapTradeHoldingsAccount-properties-meta + type: object + SnapTradeHoldingsAccountAccountId: + additionalProperties: true + description: A single brokerage account at a financial institution. + example: + number: Q6542138443 + balance: + total: + amount: 15363.23 + currency: USD + brokerage_authorization: 87b24961-b51e-4db8-9226-f198f6518a89 + meta: + type: Margin + status: ACTIVE + institution_name: Alpaca + name: Robinhood Individual + id: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + portfolio_group: 2bcd7cc3-e922-4976-bce1-9858296801c3 + created_date: 2024-07-23T22:50:22.761Z + institution_name: Alpaca + cash_restrictions: + - amount: 100 + currency: 2bcd7cc3-e922-4976-bce1-9858296801c3 + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: ALLOCATE_MAX + account: 2bcd7cc3-e922-4976-bce1-9858296801c3 + - amount: 100 + currency: 2bcd7cc3-e922-4976-bce1-9858296801c3 + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: ALLOCATE_MAX + account: 2bcd7cc3-e922-4976-bce1-9858296801c3 + properties: + id: + description: Unique identifier for the connected brokerage account. This + is the UUID used to reference the account in SnapTrade. + example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + format: uuid + type: string + x-konfig-original-example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-AccountID + brokerage_authorization: + description: Unique identifier for the connection (brokerage authorization). + This is the UUID used to reference the connection in SnapTrade. + example: 87b24961-b51e-4db8-9226-f198f6518a89 + format: uuid + type: string + x-konfig-original-example: 87b24961-b51e-4db8-9226-f198f6518a89 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-BrokerageAuthID + portfolio_group: + deprecated: true + description: Portfolio Group ID. Portfolio Groups have been deprecated. + Please contact support if you have a usecase for it. + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-PortfolioGroupID + name: + description: "A display name for the account. Either assigned by the user\ + \ or by the financial institution itself. For certain institutions, SnapTrade\ + \ appends the institution name to the account name for clarity." + example: Robinhood Individual + nullable: true + type: string + x-konfig-original-example: Robinhood Individual + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SnapTradeHoldingsAccountAccountId-properties-name + number: + description: The account number assigned by the financial institution. + example: Q6542138443 + type: string + x-konfig-original-example: Q6542138443 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SnapTradeHoldingsAccountAccountId-properties-number + institution_name: + description: The name of the financial institution that holds the account. + example: Alpaca + type: string + x-konfig-original-example: Alpaca + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SnapTradeHoldingsAccountAccountId-properties-institution_name + balance: + $ref: '#/components/schemas/AccountBalanceNullable' + meta: + additionalProperties: true + deprecated: true + description: "Additional information about the account, such as account\ + \ type, status, etc. This information is specific to the financial institution\ + \ and there's no standard format for this data. Please use at your own\ + \ risk." + example: + type: Margin + status: ACTIVE + institution_name: Alpaca + type: object + x-konfig-original-example: + type: Margin + status: ACTIVE + institution_name: Alpaca + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SnapTradeHoldingsAccountAccountId-properties-meta + cash_restrictions: + deprecated: true + description: This field is deprecated. + items: + $ref: '#/components/schemas/CashRestriction' + type: array + created_date: + description: "Timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601)\ + \ format indicating when the account was created in SnapTrade. This is\ + \ _not_ the account opening date at the financial institution." + example: 2024-07-23T22:50:22.761Z + format: date-time + type: string + x-konfig-original-example: 2024-07-23T22:50:22.761Z + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SnapTradeHoldingsAccountAccountId-properties-created_date + type: object + x-konfig-properties: + balance: + nullable: true + SnapTradeHoldingsTotalValue: + additionalProperties: true + description: "The total market value of the account. Note that this field is\ + \ calculated based on the sum of the values of account positions and cash\ + \ balances known to SnapTrade. It may not be accurate if the brokerage account\ + \ has holdings that SnapTrade is not aware of. For example, if the brokerage\ + \ account holds assets that SnapTrade does not support, the total value may\ + \ be underreported. To get the brokerage reported total market value of the\ + \ account, refer to `account.balance.total`." + example: + currency: USD + value: 32600.71 + properties: + value: + description: Total value denominated in the currency of the `currency` field. + example: 32600.71 + nullable: true + type: number + x-konfig-original-example: 32600.71 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SnapTradeHoldingsTotalValue-properties-value + currency: + description: The ISO-4217 currency code for the amount. + example: USD + nullable: true + type: string + x-konfig-original-example: USD + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SnapTradeHoldingsTotalValue-properties-currency + type: object + Balance: + additionalProperties: true + description: Holds balance information for a single currency in an account. + example: + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + cash: 300.71 + buying_power: 410.71 + properties: + currency: + $ref: '#/components/schemas/Currency' + cash: + description: The amount of available cash in the account denominated in + the currency of the `currency` field. + example: 300.71 + nullable: true + type: number + x-konfig-original-example: 300.71 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Balance-properties-cash + buying_power: + description: "Buying power only applies to margin accounts. For non-margin\ + \ accounts, buying power should be the same as cash. Please note that\ + \ this field is not always available for all brokerages." + example: 410.71 + nullable: true + type: number + x-konfig-original-example: 410.71 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Balance-properties-buying_power + type: object + ConsumerKey: + description: Shared key used to sign requests + example: UxrFb4cHdRWlmJKNuJjA6hoaN8uVa6jPGFVUl2UKHuKmurCnaU + type: string + x-konfig-original-example: UxrFb4cHdRWlmJKNuJjA6hoaN8uVa6jPGFVUl2UKHuKmurCnaU + x-konfig-generated-schema: konfig-generated-schema-components-schemas-ConsumerKey + Currency: + additionalProperties: true + description: Describes a currency object. + example: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + properties: + id: + description: Unique identifier for the currency. This is the UUID used to + reference the currency in SnapTrade. + example: 87b24961-b51e-4db8-9226-f198f6518a89 + format: uuid + type: string + x-konfig-original-example: 87b24961-b51e-4db8-9226-f198f6518a89 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Currency-properties-id + code: + description: The ISO-4217 currency code for the currency. + example: USD + type: string + x-konfig-original-example: USD + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Currency-properties-code + name: + description: A human-friendly name of the currency. + example: US Dollar + type: string + x-konfig-original-example: US Dollar + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Currency-properties-name + type: object + Exchange: + additionalProperties: true + description: Stock Exchange + example: + start_time: 09:30:00 + mic_code: XTSE + code: TSX + timezone: America/New_York + name: Toronto Stock Exchange + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + close_time: "57600" + suffix: .TO + properties: + id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + code: + example: TSX + type: string + x-konfig-original-example: TSX + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Exchange-properties-code + mic_code: + example: XTSE + type: string + x-konfig-original-example: XTSE + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Exchange-properties-mic_code + name: + example: Toronto Stock Exchange + type: string + x-konfig-original-example: Toronto Stock Exchange + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Exchange-properties-name + timezone: + example: America/New_York + type: string + x-konfig-original-example: America/New_York + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Exchange-properties-timezone + start_time: + example: 09:30:00 + type: string + x-konfig-original-example: 09:30:00 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Exchange-properties-start_time + close_time: + example: "57600" + type: string + x-konfig-original-example: 57600 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Exchange-properties-close_time + suffix: + example: .TO + nullable: true + type: string + x-konfig-original-example: .TO + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Exchange-properties-suffix + type: object + USExchange: + additionalProperties: true + description: US Stock Exchange + example: + start_time: 09:30:00 + mic_code: ARCA + code: ARCX + timezone: America/New_York + name: NYSE ARCA + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + close_time: "57600" + suffix: None + allows_cryptocurrency_symbols: false + properties: + id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + code: + example: ARCX + type: string + x-konfig-original-example: ARCX + x-konfig-generated-schema: konfig-generated-schema-components-schemas-USExchange-properties-code + mic_code: + example: ARCA + type: string + x-konfig-original-example: ARCA + x-konfig-generated-schema: konfig-generated-schema-components-schemas-USExchange-properties-mic_code + name: + example: NYSE ARCA + type: string + x-konfig-original-example: NYSE ARCA + x-konfig-generated-schema: konfig-generated-schema-components-schemas-USExchange-properties-name + timezone: + example: America/New_York + type: string + x-konfig-original-example: America/New_York + x-konfig-generated-schema: konfig-generated-schema-components-schemas-USExchange-properties-timezone + start_time: + example: 09:30:00 + type: string + x-konfig-original-example: 09:30:00 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-USExchange-properties-start_time + close_time: + example: "57600" + type: string + x-konfig-original-example: 57600 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-USExchange-properties-close_time + suffix: + example: None + nullable: true + type: string + x-konfig-original-example: None + x-konfig-generated-schema: konfig-generated-schema-components-schemas-USExchange-properties-suffix + allows_cryptocurrency_symbols: + example: false + type: boolean + x-konfig-original-example: false + x-konfig-generated-schema: konfig-generated-schema-components-schemas-USExchange-properties-allows_cryptocurrency_symbols + type: object + JWT: + additionalProperties: true + description: JWT Token. Used to acess resources in private endpoints available + only through the Passiv app + properties: + token: + example: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VybmFtZSI6ImZSbUdsbWFyU1dtZDY5RDkyeGZWbVdCWUxCS0x0QiIsImV4cCI6MTU0MDA1NTMxOSwiZW1haWwiOiJ3b29kQHN5bmNocm92ZXJnZS5jb20iLCJvcmlnX2lhdCI6MTUzNzM3NjkxOX0.ZSn85i3kSBvEP5wuhWOE8_w903N1G1AfiVlD3fmri78 + format: jwt + type: string + x-konfig-original-example: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VybmFtZSI6ImZSbUdsbWFyU1dtZDY5RDkyeGZWbVdCWUxCS0x0QiIsImV4cCI6MTU0MDA1NTMxOSwiZW1haWwiOiJ3b29kQHN5bmNocm92ZXJnZS5jb20iLCJvcmlnX2lhdCI6MTUzNzM3NjkxOX0.ZSn85i3kSBvEP5wuhWOE8_w903N1G1AfiVlD3fmri78 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-JWT-properties-token + type: object + LoginRedirectURI: + description: Redirect uri upon successful login + properties: + redirectURI: + example: https://app.snaptrade.com/snapTrade/redeemToken?token=this$token1does2ntactu4allyexist==&clientId=example + x-konfig-original-example: https://app.snaptrade.com/snapTrade/redeemToken?token=this$token1does2ntactu4allyexist==&clientId=example + sessionId: + type: string + type: object + ClientID: + description: SnapTrade Client ID (generated and provided to partner by SnapTrade) + example: SNAPTRADETEST + type: string + x-konfig-original-example: SNAPTRADETEST + x-konfig-generated-schema: konfig-generated-schema-components-schemas-ClientID + UserID: + description: "SnapTrade User ID. This is chosen by the API partner and can be\ + \ any string that is a) unique to the user, and b) immutable for the user.\ + \ It is recommended to NOT use email addresses for this property because they\ + \ are usually not immutable." + example: snaptrade-user-123 + type: string + x-konfig-original-example: snaptrade-user-123 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-UserID + UserSecret: + description: SnapTrade User Secret (generated when registering user) + example: USERSECRET123 + type: string + x-konfig-original-example: USERSECRET123 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-UserSecret + PerformanceCustom: + additionalProperties: true + description: Performance Custom Response Object + example: + fees: 2.72 + detailedMode: true + dividendIncome: 135.97 + returnRateTimeframe: + - rateOfReturn: 0.012312367452 + periodStart: 2022-01-24T00:00:00.000+00:00 + periodEnd: 2022-01-24T00:00:00.000+00:00 + - rateOfReturn: 0.012312367452 + periodStart: 2022-01-24T00:00:00.000+00:00 + periodEnd: 2022-01-24T00:00:00.000+00:00 + forexFees: 5.26 + totalEquityTimeframe: + - date: 2022-01-24T00:00:00.000+00:00 + currency: CAD + value: 52.74 + - date: 2022-01-24T00:00:00.000+00:00 + currency: CAD + value: 52.74 + rateOfReturn: 0.082312367452 + contributionTimeframeCumulative: + - date: 2022-01-24T00:00:00.000+00:00 + currency: CAD + value: 52.74 + - date: 2022-01-24T00:00:00.000+00:00 + currency: CAD + value: 52.74 + contributionTotalMonths: 13 + contributions: + date: 2022-01-24T00:00:00.000+00:00 + contributions: 524.74 + currency: CAD + withdrawalTimeframe: + - date: 2022-01-24T00:00:00.000+00:00 + currency: CAD + value: 52.74 + - date: 2022-01-24T00:00:00.000+00:00 + currency: CAD + value: 52.74 + commissions: 3.26 + dividends: + - symbol: + figi_code: BBG000B9XRY4 + symbol: VAB.TO + figi_instrument: + figi_code: BBG000B9Y5X2 + figi_share_class: BBG001S5N8V8 + raw_symbol: VAB + description: VANGUARD CDN AGGREGATE BOND INDEX ETF + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + exchange: + start_time: 09:30:00 + mic_code: XTSE + code: TSX + timezone: America/New_York + name: Toronto Stock Exchange + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + close_time: "57600" + suffix: .TO + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: + is_supported: true + code: cs + description: Common Stock + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + currencies: + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + amount: 165.05 + currency: USD + - symbol: + figi_code: BBG000B9XRY4 + symbol: VAB.TO + figi_instrument: + figi_code: BBG000B9Y5X2 + figi_share_class: BBG001S5N8V8 + raw_symbol: VAB + description: VANGUARD CDN AGGREGATE BOND INDEX ETF + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + exchange: + start_time: 09:30:00 + mic_code: XTSE + code: TSX + timezone: America/New_York + name: Toronto Stock Exchange + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + close_time: "57600" + suffix: .TO + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: + is_supported: true + code: cs + description: Common Stock + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + currencies: + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + amount: 165.05 + currency: USD + contributionStreak: 5 + contributionMonthsContributed: 10 + badTickers: + - MAW105 + - MAW105 + monthlyDividends: 26.37 + dividendTimeline: + - date: 2022-01-24T00:00:00.000+00:00 + dividends: + - symbol: AAPL + amount: 6.82 + currency: CAD + - symbol: AAPL + amount: 6.82 + currency: CAD + - date: 2022-01-24T00:00:00.000+00:00 + dividends: + - symbol: AAPL + amount: 6.82 + currency: CAD + - symbol: AAPL + amount: 6.82 + currency: CAD + contributionTimeframe: + - date: 2022-01-24T00:00:00.000+00:00 + currency: CAD + value: 52.74 + - date: 2022-01-24T00:00:00.000+00:00 + currency: CAD + value: 52.74 + properties: + totalEquityTimeframe: + items: + $ref: '#/components/schemas/PastValue' + type: array + contributions: + $ref: '#/components/schemas/NetContributions' + contributionTimeframe: + items: + $ref: '#/components/schemas/PastValue' + type: array + contributionTimeframeCumulative: + items: + $ref: '#/components/schemas/PastValue' + type: array + withdrawalTimeframe: + items: + $ref: '#/components/schemas/PastValue' + type: array + contributionStreak: + description: Current streak of cosecutive months where contributions were + made + example: 5 + nullable: true + type: number + x-konfig-original-example: 5 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-PerformanceCustom-properties-contributionStreak + contributionMonthsContributed: + description: Number of months in the timeframe with contributions + example: 10 + nullable: true + type: number + x-konfig-original-example: 10 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-PerformanceCustom-properties-contributionMonthsContributed + contributionTotalMonths: + description: Total months in timeframe + example: 13 + nullable: true + type: number + x-konfig-original-example: 13 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-PerformanceCustom-properties-contributionTotalMonths + dividends: + items: + $ref: '#/components/schemas/NetDividend' + type: array + dividendIncome: + description: Total dividends received over the timeframe + example: 135.97 + nullable: true + type: number + x-konfig-original-example: 135.97 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-PerformanceCustom-properties-dividendIncome + monthlyDividends: + description: Average dividends received per month over the timeframe + example: 26.37 + nullable: true + type: number + x-konfig-original-example: 26.37 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-PerformanceCustom-properties-monthlyDividends + badTickers: + description: list of tickers which may not be supported or may not have + accurate price data + items: + example: MAW105 + nullable: true + type: string + x-konfig-original-example: MAW105 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-PerformanceCustom-properties-badTickers-items + type: array + dividendTimeline: + items: + $ref: '#/components/schemas/MonthlyDividends' + type: array + commissions: + description: commissions incurred during the timeframe + example: 3.26 + nullable: true + type: number + x-konfig-original-example: 3.26 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-PerformanceCustom-properties-commissions + forexFees: + description: forex fees incurred during the timeframe + example: 5.26 + nullable: true + type: number + x-konfig-original-example: 5.26 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-PerformanceCustom-properties-forexFees + fees: + description: other fees incurred during the timeframe + example: 2.72 + nullable: true + type: number + x-konfig-original-example: 2.72 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-PerformanceCustom-properties-fees + rateOfReturn: + description: The return rate over the timeframe. Annualized if timeframe + is longer than 1 year + example: 0.082312367452 + nullable: true + type: number + x-konfig-original-example: 0.082312367452 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-PerformanceCustom-properties-rateOfReturn + returnRateTimeframe: + items: + $ref: '#/components/schemas/SubPeriodReturnRate' + type: array + detailedMode: + description: Whether the user has detailed mode enabled (more frequent data + points for totalEquity and contribution timeframes) + type: boolean + type: object + x-konfig-is-used-in-successful-response: true + SubPeriodReturnRate: + additionalProperties: true + example: + rateOfReturn: 0.012312367452 + periodStart: 2022-01-24T00:00:00.000+00:00 + periodEnd: 2022-01-24T00:00:00.000+00:00 + properties: + periodStart: + description: Date used to specify timeframe for a reporting call (in YYYY-MM-DD + format) + example: 2022-01-24 + format: date + type: string + x-konfig-original-example: 2022-01-24 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-ReportingDate + periodEnd: + description: Date used to specify timeframe for a reporting call (in YYYY-MM-DD + format) + example: 2022-01-24 + format: date + type: string + x-konfig-original-example: 2022-01-24 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-ReportingDate + rateOfReturn: + description: The return rate for the given period + example: 0.012312367452 + nullable: true + type: number + x-konfig-original-example: 0.012312367452 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SubPeriodReturnRate-properties-rateOfReturn + type: object + DividendAtDate: + additionalProperties: true + example: + symbol: AAPL + amount: 6.82 + currency: CAD + properties: + symbol: + description: The ticker of the symbol that the dividend came from + example: AAPL + nullable: true + type: string + x-konfig-original-example: AAPL + x-konfig-generated-schema: konfig-generated-schema-components-schemas-DividendAtDate-properties-symbol + amount: + description: The amount received from the dividend + example: 6.82 + nullable: true + type: number + x-konfig-original-example: 6.82 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-DividendAtDate-properties-amount + currency: + description: The currency of the amount + example: CAD + type: string + x-konfig-original-example: CAD + x-konfig-generated-schema: konfig-generated-schema-components-schemas-DividendAtDate-properties-currency + type: object + PartnerData: + additionalProperties: true + description: SnapTrade Partner metadata + example: + can_access_trades: true + can_access_holdings: true + pin_required: false + can_access_account_history: true + can_access_orders: true + logo_url: https://example.com/logo.png + can_access_reference_data: true + name: Wealthy Chimpmunk + can_access_portfolio_management: true + redirect_uri: https://example.com/oauth/snaptrade + slug: WEALTHYCHIPMUNK + allowed_brokerages: + - maintenance_mode: true + allows_fractional_units: true + exchanges: + - 2bcd7cc3-e922-4976-bce1-9858296801c3 + - 4bcd8cc3-c122-4974-dc21-1858296801f4 + description: Questrade is an online brokerage firm and wealth management + firm based in Canada. It is Canada's largest discount broker. + open_url: https://www.brokerage.com + display_name: Questrade + url: https://www.questrade.com/ + enabled: true + allows_trading: true + has_reporting: true + aws_s3_square_logo_url: https://www.snaptrade.com/questrade.logo + is_real_time_connection: true + name: Questrade + allows_trading_through_snaptrade_api: true + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + default_currency: 2bcd7cc3-e922-4976-bce1-9858296801c3 + brokerage_type: + name: Traditional Brokerage + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + aws_s3_logo_url: https://www.snaptrade.com/questrade.logo + slug: QUESTRADE + is_scraping_integration: true + - maintenance_mode: true + allows_fractional_units: true + exchanges: + - 2bcd7cc3-e922-4976-bce1-9858296801c3 + - 4bcd8cc3-c122-4974-dc21-1858296801f4 + description: Questrade is an online brokerage firm and wealth management + firm based in Canada. It is Canada's largest discount broker. + open_url: https://www.brokerage.com + display_name: Questrade + url: https://www.questrade.com/ + enabled: true + allows_trading: true + has_reporting: true + aws_s3_square_logo_url: https://www.snaptrade.com/questrade.logo + is_real_time_connection: true + name: Questrade + allows_trading_through_snaptrade_api: true + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + default_currency: 2bcd7cc3-e922-4976-bce1-9858296801c3 + brokerage_type: + name: Traditional Brokerage + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + aws_s3_logo_url: https://www.snaptrade.com/questrade.logo + slug: QUESTRADE + is_scraping_integration: true + properties: + redirect_uri: + description: URI to redirect user back to after user is done adding brokerage + connections + example: https://example.com/oauth/snaptrade + type: string + x-konfig-original-example: https://example.com/oauth/snaptrade + x-konfig-generated-schema: konfig-generated-schema-components-schemas-PartnerData-properties-redirect_uri + allowed_brokerages: + description: Brokerages that can be accessed by partners + items: + $ref: '#/components/schemas/Brokerage' + type: array + name: + description: Name of Snaptrade Partner + example: Wealthy Chimpmunk + type: string + x-konfig-original-example: Wealthy Chimpmunk + x-konfig-generated-schema: konfig-generated-schema-components-schemas-PartnerData-properties-name + slug: + description: Slug of Snaptrade Partner + example: WEALTHYCHIPMUNK + type: string + x-konfig-original-example: WEALTHYCHIPMUNK + x-konfig-generated-schema: konfig-generated-schema-components-schemas-PartnerData-properties-slug + logo_url: + description: URL to partner's logo + example: https://example.com/logo.png + type: string + x-konfig-original-example: https://example.com/logo.png + x-konfig-generated-schema: konfig-generated-schema-components-schemas-PartnerData-properties-logo_url + pin_required: + description: Shows if pin is required by users to access connection page + example: false + type: boolean + x-konfig-original-example: false + x-konfig-generated-schema: konfig-generated-schema-components-schemas-PartnerData-properties-pin_required + can_access_trades: + description: Shows if users of Snaptrade partners can access trade endpoints + example: true + type: boolean + x-konfig-original-example: true + x-konfig-generated-schema: konfig-generated-schema-components-schemas-PartnerData-properties-can_access_trades + can_access_holdings: + description: Shows if Snaptrade partners can get user holdings data + example: true + type: boolean + x-konfig-original-example: true + x-konfig-generated-schema: konfig-generated-schema-components-schemas-PartnerData-properties-can_access_holdings + can_access_account_history: + description: Shows if Snaptrade partners can get users account history data + example: true + type: boolean + x-konfig-original-example: true + x-konfig-generated-schema: konfig-generated-schema-components-schemas-PartnerData-properties-can_access_account_history + can_access_reference_data: + description: Shows if Snaptrade partners can get users holdings data + example: true + type: boolean + x-konfig-original-example: true + x-konfig-generated-schema: konfig-generated-schema-components-schemas-PartnerData-properties-can_access_reference_data + can_access_portfolio_management: + description: Shows if users Snaptrade partners can access portfolio group + management features + example: true + type: boolean + x-konfig-original-example: true + x-konfig-generated-schema: konfig-generated-schema-components-schemas-PartnerData-properties-can_access_portfolio_management + can_access_orders: + description: Shows if Snaptrade partners can get users account order history + example: true + type: boolean + x-konfig-original-example: true + x-konfig-generated-schema: konfig-generated-schema-components-schemas-PartnerData-properties-can_access_orders + type: object + x-konfig-is-used-in-successful-response: true + Position: + additionalProperties: true + description: Describes a single stock/ETF/crypto/mutual fund position in an + account. + example: + symbol: + is_quotable: true + symbol: + figi_code: BBG000B9XRY4 + symbol: VAB.TO + figi_instrument: + figi_code: BBG000B9Y5X2 + figi_share_class: BBG001S5N8V8 + raw_symbol: VAB + description: VANGUARD CDN AGGREGATE BOND INDEX ETF + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + exchange: + start_time: 09:30:00 + mic_code: XTSE + code: TSX + timezone: America/New_York + name: Toronto Stock Exchange + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + close_time: "57600" + suffix: .TO + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: + is_supported: true + code: cs + description: Common Stock + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + currencies: + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + is_tradable: true + local_id: "3291231" + description: VANGUARD CDN AGGREGATE BOND INDEX ETF + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + fractional_units: 1.44 + price: 113.15 + open_pnl: 0.44 + units: 40 + average_purchase_price: 108.3353 + properties: + symbol: + $ref: '#/components/schemas/PositionSymbol' + units: + description: The number of shares of the position. This can be fractional + or integer units. + example: 40 + nullable: true + type: number + x-konfig-original-example: 40 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Position-properties-units + price: + description: "Last known market price for the symbol. The freshness of this\ + \ price depends on the brokerage. Some brokerages provide real-time prices,\ + \ while others provide delayed prices. It is recommended that you rely\ + \ on your own third-party market data provider for most up to date prices." + example: 113.15 + nullable: true + type: number + x-konfig-original-example: 113.15 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Position-properties-price + open_pnl: + description: "The profit or loss on the position since it was opened. This\ + \ is calculated as the difference between the current market value of\ + \ the position and the total cost of the position. It is recommended to\ + \ calculate this value using the average purchase price and the current\ + \ market price yourself, instead of relying on this field." + example: 0.44 + nullable: true + type: number + x-konfig-original-example: 0.44 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Position-properties-open_pnl + fractional_units: + deprecated: true + description: "Deprecated, use the `units` field for both fractional and\ + \ integer units going forward" + example: 1.44 + nullable: true + type: number + x-konfig-original-example: 1.44 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Position-properties-fractional_units + average_purchase_price: + description: Cost basis _per share_ of this position. + example: 108.3353 + nullable: true + type: number + x-konfig-original-example: 108.3353 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Position-properties-average_purchase_price + type: object + RedirectTokenandPin: + additionalProperties: true + description: Response when register user is successful + properties: + token: + example: myDAIBCP/EYqSmMByhMRB65aMa%2BdYhu2xRsGQe0sDd9SgZXMbdRh3eBaTh/bLViVGQoil6p9ytUUVhkqWalejOqCNVkXXTk/iNPTPaFCeh9%2B + type: string + x-konfig-original-example: myDAIBCP/EYqSmMByhMRB65aMa%2BdYhu2xRsGQe0sDd9SgZXMbdRh3eBaTh/bLViVGQoil6p9ytUUVhkqWalejOqCNVkXXTk/iNPTPaFCeh9%2B + x-konfig-generated-schema: konfig-generated-schema-components-schemas-RedirectTokenandPin-properties-token + pin: + example: usERdeFiP@1in9 + type: string + x-konfig-original-example: usERdeFiP@1in9 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-RedirectTokenandPin-properties-pin + type: object + Signature: + description: | + Steps to generate a signature + * Prepare signed content (see SignedContent schema) + * Sign content prepared above with HMAC-SHA256 using the UTF-8 encoding + * Return base64 encoding of sign content along with headers + Note: Use the shared consumer key provided by SnapTrade to signed the request + Example python code + ``` + import hmac + import json + from base64 import b64encode + from hashlib import sha256 + from urllib.parse import urlencode + consumer_key = "UxrFb4cHdRWlmJKNuJjA6hoaN8uVa6jPGFVUl2UKHuKmurCnaU".encode() + request_data = {'userId': 'snaptrade-user-123', 'userSecret': 'CHRIS.P.BACON'} + request_path = "/api/v1/snapTrade/mockSignature" + request_query = "clientId=SNAPTRADETEST×tamp=1635790389" + sig_object = {"content": request_data, "path": request_path, "query": request_query} + sig_content = json.dumps(sig_object, separators=(",", ":"), sort_keys=True) + sig_digest = hmac.new(consumer_key, sig_content.encode(), sha256).digest() + signature = b64encode(sig_digest).decode() + ``` + example: QJPQgW0Y8mWbG9Whw/fhCYofIgSo/UAo2AIc1bBPMnY= + type: string + x-konfig-original-example: QJPQgW0Y8mWbG9Whw/fhCYofIgSo/UAo2AIc1bBPMnY= + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Signature + SignedContent: + description: | + Signed content requires 3 key-value pairs + * content -> Content included in request body, set to null if no content is included. Sort keys in content alphabetically + * path -> Url path of request submitted + * query -> Query params included in requests + After preparing the key-value pairs, sort them alphabetically and convert them + into a string. + Note: + Remove any extra whitespace characters and delimiters from the signed content. + For example, some JSON rendering engines will produce output like this: + -- `{"blue": "moon", "hello": "world"}` + To produce the correct signature, the JSON should be processed to look like this: + -- `{"blue":"moon","hello":"world"}` + example: "{\"content\":{\"userId\":\"snaptrade-user-123\",\"userSecret\":\"\ + CHRIS.P.BACON\"},\"path\":\"/api/v1/snapTrade/mockSignature\",\"query\":\"\ + clientId=SNAPTRADETEST×tamp=1635790389\"}" + type: string + x-konfig-original-example: "{\"content\":{\"userId\":\"snaptrade-user-123\"\ + ,\"userSecret\":\"CHRIS.P.BACON\"},\"path\":\"/api/v1/snapTrade/mockSignature\"\ + ,\"query\":\"clientId=SNAPTRADETEST×tamp=1635790389\"}" + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SignedContent + SnapTradeRegisterUserRequestBody: + description: Data required to register a user via SnapTrade Partner + example: + userId: snaptrade-user-123 + properties: + userId: + description: "SnapTrade User ID. This is chosen by the API partner and can\ + \ be any string that is a) unique to the user, and b) immutable for the\ + \ user. It is recommended to NOT use email addresses for this property\ + \ because they are usually not immutable." + example: snaptrade-user-123 + type: string + x-konfig-original-example: snaptrade-user-123 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SnapTradeUserID + type: object + SnapTradeLoginUserRequestBody: + description: Data to login a user via SnapTrade Partner + example: + connectionPortalVersion: v2 + reconnect: 8b5f262d-4bb9-365d-888a-202bd3b15fa1 + immediateRedirect: true + customRedirect: https://snaptrade.com + broker: ALPACA + connectionType: read + properties: + broker: + description: "Slug of the brokerage to connect the user to. See [this document](https://snaptrade.notion.site/SnapTrade-Brokerage-Integrations-f83946a714a84c3caf599f6a945f0ead)\ + \ for a list of supported brokerages and their slugs." + example: ALPACA + type: string + x-konfig-original-example: ALPACA + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SnapTradeLoginUserRequestBody-properties-broker + immediateRedirect: + description: "When set to True, user will be redirected back to the partner's\ + \ site instead of the connection portal" + example: true + type: boolean + x-konfig-original-example: true + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SnapTradeLoginUserRequestBody-properties-immediateRedirect + customRedirect: + description: URL to redirect the user to after the user connects their brokerage + account + example: https://snaptrade.com + type: string + x-konfig-original-example: https://snaptrade.com + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SnapTradeLoginUserRequestBody-properties-customRedirect + reconnect: + description: The UUID of the brokerage connection to be reconnected. This + parameter should be left empty unless you are reconnecting a disabled + connection. See ‘Reconnecting Accounts’ for more information. + example: 8b5f262d-4bb9-365d-888a-202bd3b15fa1 + type: string + x-konfig-original-example: 8b5f262d-4bb9-365d-888a-202bd3b15fa1 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SnapTradeLoginUserRequestBody-properties-reconnect + connectionType: + description: Sets whether the connection should be read or trade + enum: + - read + - trade + type: string + connectionPortalVersion: + description: "Sets the version of the connection portal to render, with\ + \ a default to 'v3'" + enum: + - v2 + - v3 + type: string + type: object + SnapTradeUserID: + description: "SnapTrade User ID. This is chosen by the API partner and can be\ + \ any string that is a) unique to the user, and b) immutable for the user.\ + \ It is recommended to NOT use email addresses for this property because they\ + \ are usually not immutable." + example: snaptrade-user-123 + type: string + x-konfig-original-example: snaptrade-user-123 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SnapTradeUserID + SnapTradeUserSecret: + description: "SnapTrade User Secret randomly generated by SnapTrade. This is\ + \ privileged information and if compromised, should be rotated via the SnapTrade\ + \ API." + example: h81@cx1lkalablakwjaltkejraj11= + type: string + x-konfig-original-example: h81@cx1lkalablakwjaltkejraj11= + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SnapTradeUserSecret + Symbol: + additionalProperties: true + description: Symbol + example: + figi_code: BBG000B9XRY4 + symbol: VAB.TO + figi_instrument: + figi_code: BBG000B9Y5X2 + figi_share_class: BBG001S5N8V8 + raw_symbol: VAB + name: Vanguard Canadian Aggregate Bond Index ETF + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + exchange: + start_time: 09:30:00 + mic_code: XTSE + code: TSX + timezone: America/New_York + name: Toronto Stock Exchange + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + close_time: "57600" + suffix: .TO + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: + is_supported: true + code: cs + description: Common Stock + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + properties: + id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + symbol: + example: VAB.TO + type: string + x-konfig-original-example: VAB.TO + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Symbol-properties-symbol + raw_symbol: + example: VAB + type: string + x-konfig-original-example: VAB + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Symbol-properties-raw_symbol + name: + example: Vanguard Canadian Aggregate Bond Index ETF + type: string + x-konfig-original-example: Vanguard Canadian Aggregate Bond Index ETF + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Symbol-properties-name + currency: + $ref: '#/components/schemas/Currency' + exchange: + $ref: '#/components/schemas/Exchange' + type: + $ref: '#/components/schemas/SecurityType' + figi_code: + example: BBG000B9XRY4 + nullable: true + type: string + x-konfig-original-example: BBG000B9XRY4 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Symbol-properties-figi_code + figi_instrument: + $ref: '#/components/schemas/FigiInstrumentNullable' + type: object + x-konfig-properties: + figi_instrument: + nullable: true + Timestamp: + description: Unix Epoch time + example: 1635790389 + externalDocs: + url: https://en.wikipedia.org/wiki/Unix_time + type: integer + x-konfig-original-example: 1635790389 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Timestamp + UserIDandSecret: + description: Response when register user is successful + example: + userSecret: h81@cx1lkalablakwjaltkejraj11= + userId: snaptrade-user-123 + properties: + userId: + description: "SnapTrade User ID. This is chosen by the API partner and can\ + \ be any string that is a) unique to the user, and b) immutable for the\ + \ user. It is recommended to NOT use email addresses for this property\ + \ because they are usually not immutable." + example: snaptrade-user-123 + type: string + x-konfig-original-example: snaptrade-user-123 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SnapTradeUserID + userSecret: + description: "SnapTrade User Secret randomly generated by SnapTrade. This\ + \ is privileged information and if compromised, should be rotated via\ + \ the SnapTrade API." + example: h81@cx1lkalablakwjaltkejraj11= + type: string + x-konfig-original-example: h81@cx1lkalablakwjaltkejraj11= + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SnapTradeUserSecret + type: object + x-konfig-is-used-in-successful-response: true + UserList: + description: List of registered SnapTrade users + example: + - user1 + - user2 + - user3 + items: + type: string + type: array + x-konfig-original-example: + - user1 + - user2 + - user3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-UserList + x-konfig-is-used-in-successful-response: true + DeleteUserResponse: + additionalProperties: true + description: Response when delete user is successful + example: + userId: snaptrade-user-123 + status: deleted + properties: + status: + description: Delete status + example: deleted + type: string + x-konfig-original-example: deleted + x-konfig-generated-schema: konfig-generated-schema-components-schemas-DeleteUserResponse-properties-status + userId: + description: "SnapTrade User ID. This is chosen by the API partner and can\ + \ be any string that is a) unique to the user, and b) immutable for the\ + \ user. It is recommended to NOT use email addresses for this property\ + \ because they are usually not immutable." + example: snaptrade-user-123 + type: string + x-konfig-original-example: snaptrade-user-123 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SnapTradeUserID + type: object + x-konfig-is-used-in-successful-response: true + BrokerageAuthorizationType: + additionalProperties: true + properties: + type: + enum: + - read + - trade + type: string + type: object + BrokerageAuthorizationTypeReadOnly: + additionalProperties: true + example: + brokerage: + name: Questrade + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + slug: QUESTRADE + auth_type: OAUTH + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: read + properties: + id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + type: + enum: + - read + - trade + type: string + auth_type: + enum: + - OAUTH + - SCRAPE + - UNOFFICIAL_API + - TOKEN + type: string + brokerage: + $ref: '#/components/schemas/BrokerageAuthorizationTypeReadOnly_brokerage' + type: object + Brokerage: + additionalProperties: true + example: + maintenance_mode: true + allows_fractional_units: true + exchanges: + - 2bcd7cc3-e922-4976-bce1-9858296801c3 + - 4bcd8cc3-c122-4974-dc21-1858296801f4 + description: Questrade is an online brokerage firm and wealth management firm + based in Canada. It is Canada's largest discount broker. + open_url: https://www.brokerage.com + display_name: Questrade + url: https://www.questrade.com/ + enabled: true + allows_trading: true + has_reporting: true + aws_s3_square_logo_url: https://www.snaptrade.com/questrade.logo + is_real_time_connection: true + name: Questrade + allows_trading_through_snaptrade_api: true + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + default_currency: 2bcd7cc3-e922-4976-bce1-9858296801c3 + brokerage_type: + name: Traditional Brokerage + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + aws_s3_logo_url: https://www.snaptrade.com/questrade.logo + slug: QUESTRADE + is_scraping_integration: true + properties: + id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + name: + description: Full name of the brokerage. + example: Questrade + type: string + x-konfig-original-example: Questrade + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Brokerage-properties-name + display_name: + description: A display-friendly name of the brokerage. + example: Questrade + type: string + x-konfig-original-example: Questrade + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Brokerage-properties-display_name + description: + example: Questrade is an online brokerage firm and wealth management firm + based in Canada. It is Canada's largest discount broker. + type: string + x-konfig-original-example: Questrade is an online brokerage firm and wealth + management firm based in Canada. It is Canada's largest discount broker. + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Brokerage-properties-description + aws_s3_logo_url: + example: https://www.snaptrade.com/questrade.logo + format: url + type: string + x-konfig-original-example: https://www.snaptrade.com/questrade.logo + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Brokerage-properties-aws_s3_logo_url + aws_s3_square_logo_url: + example: https://www.snaptrade.com/questrade.logo + format: url + nullable: true + type: string + x-konfig-original-example: https://www.snaptrade.com/questrade.logo + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Brokerage-properties-aws_s3_square_logo_url + open_url: + example: https://www.brokerage.com + format: url + nullable: true + type: string + x-konfig-original-example: https://www.brokerage.com + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Brokerage-properties-open_url + slug: + description: A unique identifier for that brokerage. It is usually the name + of the brokerage in capital letters and will never change. + example: QUESTRADE + type: string + x-konfig-original-example: QUESTRADE + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Brokerage-properties-slug + url: + example: https://www.questrade.com/ + format: url + type: string + x-konfig-original-example: https://www.questrade.com/ + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Brokerage-properties-url + enabled: + example: true + type: boolean + x-konfig-original-example: true + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Brokerage-properties-enabled + maintenance_mode: + example: true + type: boolean + x-konfig-original-example: true + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Brokerage-properties-maintenance_mode + allows_fractional_units: + example: true + nullable: true + type: boolean + x-konfig-original-example: true + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Brokerage-properties-allows_fractional_units + allows_trading: + example: true + nullable: true + type: boolean + x-konfig-original-example: true + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Brokerage-properties-allows_trading + has_reporting: + example: true + nullable: true + type: boolean + x-konfig-original-example: true + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Brokerage-properties-has_reporting + is_real_time_connection: + example: true + type: boolean + x-konfig-original-example: true + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Brokerage-properties-is_real_time_connection + allows_trading_through_snaptrade_api: + example: true + nullable: true + type: boolean + x-konfig-original-example: true + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Brokerage-properties-allows_trading_through_snaptrade_api + is_scraping_integration: + example: true + type: boolean + x-konfig-original-example: true + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Brokerage-properties-is_scraping_integration + default_currency: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + brokerage_type: + $ref: '#/components/schemas/BrokerageType' + exchanges: + description: List of exchange ID supported by brokerage + example: + - 2bcd7cc3-e922-4976-bce1-9858296801c3 + - 4bcd8cc3-c122-4974-dc21-1858296801f4 + items: {} + type: array + x-konfig-original-example: + - 2bcd7cc3-e922-4976-bce1-9858296801c3 + - 4bcd8cc3-c122-4974-dc21-1858296801f4 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Brokerage-properties-exchanges + type: object + BrokerageAuthorization: + additionalProperties: true + example: + brokerage: + maintenance_mode: true + allows_fractional_units: true + exchanges: + - 2bcd7cc3-e922-4976-bce1-9858296801c3 + - 4bcd8cc3-c122-4974-dc21-1858296801f4 + description: Questrade is an online brokerage firm and wealth management + firm based in Canada. It is Canada's largest discount broker. + open_url: https://www.brokerage.com + display_name: Questrade + url: https://www.questrade.com/ + enabled: true + allows_trading: true + has_reporting: true + aws_s3_square_logo_url: https://www.snaptrade.com/questrade.logo + is_real_time_connection: true + name: Questrade + allows_trading_through_snaptrade_api: true + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + default_currency: 2bcd7cc3-e922-4976-bce1-9858296801c3 + brokerage_type: + name: Traditional Brokerage + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + aws_s3_logo_url: https://www.snaptrade.com/questrade.logo + slug: QUESTRADE + is_scraping_integration: true + disabled_date: 2022-01-21T20:11:19.217Z + meta: + identifier: 123456 + name: Connection-1 + disabled: false + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + created_date: 2022-01-21T20:11:19.217Z + updated_date: 2022-01-21T20:11:19.217Z + type: trade + properties: + id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + created_date: + description: Time + example: 2022-01-21T20:11:19.217Z + type: string + x-konfig-original-example: 2022-01-21T20:11:19.217Z + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Time + updated_date: + description: Time + example: 2022-01-21T20:11:19.217Z + type: string + x-konfig-original-example: 2022-01-21T20:11:19.217Z + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Time + brokerage: + $ref: '#/components/schemas/Brokerage' + name: + description: Connection Name + example: Connection-1 + type: string + x-konfig-original-example: Connection-1 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-BrokerageAuthorization-properties-name + type: + example: trade + type: string + x-konfig-original-example: trade + x-konfig-generated-schema: konfig-generated-schema-components-schemas-BrokerageAuthorization-properties-type + disabled: + example: false + type: boolean + x-konfig-original-example: false + x-konfig-generated-schema: konfig-generated-schema-components-schemas-BrokerageAuthorization-properties-disabled + disabled_date: + description: Disabled date + example: 2022-01-21T20:11:19.217Z + nullable: true + type: string + x-konfig-original-example: 2022-01-21T20:11:19.217Z + x-konfig-generated-schema: konfig-generated-schema-components-schemas-BrokerageAuthorization-properties-disabled_date + meta: + additionalProperties: true + description: Additional data about brokerage authorization + example: + identifier: 123456 + type: object + x-konfig-original-example: + identifier: 123456 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-BrokerageAuthorization-properties-meta + type: object + x-konfig-is-used-in-successful-response: true + BrokerageAuthorizationRefreshConfirmation: + additionalProperties: true + example: + detail: Connection 0b3ebefb-ed47-43df-cd8f-729a4420b5cf scheduled for refresh + properties: + detail: + description: Refresh confirmation details + example: Connection 0b3ebefb-ed47-43df-cd8f-729a4420b5cf scheduled for refresh + type: string + x-konfig-original-example: Connection 0b3ebefb-ed47-43df-cd8f-729a4420b5cf + scheduled for refresh + x-konfig-generated-schema: konfig-generated-schema-components-schemas-BrokerageAuthorizationRefreshConfirmation-properties-detail + type: object + x-konfig-is-used-in-successful-response: true + BrokerageAuthorizationDisabledConfirmation: + additionalProperties: true + example: + detail: Connection 0b3ebefb-ed47-43df-cd8f-729a4420b5cf has been disabled + properties: + detail: + description: Connection disabled confirmation + example: Connection 0b3ebefb-ed47-43df-cd8f-729a4420b5cf has been disabled + type: string + x-konfig-original-example: Connection 0b3ebefb-ed47-43df-cd8f-729a4420b5cf + has been disabled + x-konfig-generated-schema: konfig-generated-schema-components-schemas-BrokerageAuthorizationDisabledConfirmation-properties-detail + type: object + x-konfig-is-used-in-successful-response: true + SessionEvent: + additionalProperties: true + example: + session_event_type: OAUTH_REDIRECT + user_id: snaptrade-user-123 + brokerage_status_code: 400 + session_id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + created_date: 2022-01-21T20:11:19.217Z + brokerage_authorization_id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + properties: + id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + session_event_type: + enum: + - OAUTH_REDIRECT + - DISCLAIMER_ACCEPTED + - BROKERAGE_CONNECTION_INITIATED + - BROKERAGE_RECONNECT_INITIATED + - BROKERAGE_AUTHENTICATION + - OAUTH_BROKERAGE_AUTHENTICATION + - MFA_REQUESTED + - MFA_SUBMITTED + - MFA_CHOICE_REQUESTED + - MFA_CHOICE_SUBMITTED + - CONNECTION_SUCCESSFUL + - CONNECTION_FAILED + - PARTNER_REDIRECT + - CONNECTION_ABORTED + - SESSION_STARTED + type: string + session_id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + user_id: + description: "SnapTrade User ID. This is chosen by the API partner and can\ + \ be any string that is a) unique to the user, and b) immutable for the\ + \ user. It is recommended to NOT use email addresses for this property\ + \ because they are usually not immutable." + example: snaptrade-user-123 + type: string + x-konfig-original-example: snaptrade-user-123 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SnapTradeUserID + created_date: + description: Time + example: 2022-01-21T20:11:19.217Z + type: string + x-konfig-original-example: 2022-01-21T20:11:19.217Z + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Time + brokerage_status_code: + example: 400 + nullable: true + type: integer + x-konfig-original-example: 400 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SessionEvent-properties-brokerage_status_code + brokerage_authorization_id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + type: object + BrokerageSymbol: + additionalProperties: true + description: Brokerage symbol + properties: + id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + symbol: + $ref: '#/components/schemas/UniversalSymbolNullable' + brokerage_authorization: + $ref: '#/components/schemas/BrokerageAuthorization' + description: + example: VANGUARD CDN AGGREGATE BOND INDEX ETF + type: string + x-konfig-original-example: VANGUARD CDN AGGREGATE BOND INDEX ETF + x-konfig-generated-schema: konfig-generated-schema-components-schemas-BrokerageSymbol-properties-description + allows_fractional_units: + example: true + nullable: true + type: boolean + x-konfig-original-example: true + x-konfig-generated-schema: konfig-generated-schema-components-schemas-BrokerageSymbol-properties-allows_fractional_units + option_symbol: + $ref: '#/components/schemas/OptionsSymbolNullable' + type: object + x-konfig-properties: + symbol: + nullable: true + option_symbol: + nullable: true + OptionBrokerageSymbol: + additionalProperties: true + description: Option Brokerage symbol + example: + description: SPY CALL 7/17 200 + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + option_symbol: + ticker: SPY 220819P00200000 + exchange_id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 + local_id: "40817960" + is_mini_option: false + option_type: CALL + underlying_symbol: + figi_code: BBG000B9XRY4 + symbol: SPY + figi_instrument: + figi_code: BBG000B9Y5X2 + figi_share_class: BBG001S5N8V8 + description: SPDR S&P 500 ETF Trust + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + exchange: + start_time: 09:30:00 + mic_code: ARCA + code: ARCX + timezone: America/New_York + name: NYSE ARCA + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + close_time: "57600" + suffix: None + allows_cryptocurrency_symbols: false + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: + is_supported: true + code: cs + description: Common Stock + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + currencies: + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + expiration_date: 2017-07-17T15:13:07.177712+00:00 + strike_price: 200 + properties: + id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + description: + example: SPY CALL 7/17 200 + type: string + x-konfig-original-example: SPY CALL 7/17 200 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-OptionBrokerageSymbol-properties-description + option_symbol: + $ref: '#/components/schemas/OptionsSymbol' + type: object + PositionSymbol: + additionalProperties: true + description: Symbol returned in position object + example: + is_quotable: true + symbol: + figi_code: BBG000B9XRY4 + symbol: VAB.TO + figi_instrument: + figi_code: BBG000B9Y5X2 + figi_share_class: BBG001S5N8V8 + raw_symbol: VAB + description: VANGUARD CDN AGGREGATE BOND INDEX ETF + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + exchange: + start_time: 09:30:00 + mic_code: XTSE + code: TSX + timezone: America/New_York + name: Toronto Stock Exchange + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + close_time: "57600" + suffix: .TO + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: + is_supported: true + code: cs + description: Common Stock + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + currencies: + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + is_tradable: true + local_id: "3291231" + description: VANGUARD CDN AGGREGATE BOND INDEX ETF + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + properties: + id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + description: + example: VANGUARD CDN AGGREGATE BOND INDEX ETF + type: string + x-konfig-original-example: VANGUARD CDN AGGREGATE BOND INDEX ETF + x-konfig-generated-schema: konfig-generated-schema-components-schemas-PositionSymbol-properties-description + symbol: + $ref: '#/components/schemas/UniversalSymbol' + local_id: + example: "3291231" + nullable: true + type: string + x-konfig-original-example: "3291231" + x-konfig-generated-schema: konfig-generated-schema-components-schemas-PositionSymbol-properties-local_id + is_quotable: + example: true + type: boolean + x-konfig-original-example: true + x-konfig-generated-schema: konfig-generated-schema-components-schemas-PositionSymbol-properties-is_quotable + is_tradable: + example: true + type: boolean + x-konfig-original-example: true + x-konfig-generated-schema: konfig-generated-schema-components-schemas-PositionSymbol-properties-is_tradable + type: object + CalculatedTrade: + additionalProperties: true + description: Array of trades to make to rebalance portfolio + properties: + id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + trades: + items: + $ref: '#/components/schemas/Trade' + type: array + type: object + OptionChain: + description: chain of options + items: + $ref: '#/components/schemas/OptionChain_inner' + type: array + x-konfig-is-used-in-successful-response: true + Email: + example: ops@snaptrade.com + format: email + type: string + x-konfig-original-example: ops@snaptrade.com + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Email + ExchangeRatePairs: + additionalProperties: true + description: The exchange rate of a pair of currencies + example: + dst: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + exchange_rate: 1.32 + src: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + properties: + src: + $ref: '#/components/schemas/Currency' + dst: + $ref: '#/components/schemas/Currency' + exchange_rate: + example: 1.32 + type: number + x-konfig-original-example: 1.32 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-ExchangeRatePairs-properties-exchange_rate + type: object + x-konfig-is-used-in-successful-response: true + ExcludedAsset: + additionalProperties: true + description: An excluded asset in a portfolio group + properties: + symbol: + $ref: '#/components/schemas/UniversalSymbol' + type: object + Id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + ModelAssetClass: + additionalProperties: true + properties: + id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + name: + example: Bonds + type: string + x-konfig-original-example: Bonds + x-konfig-generated-schema: konfig-generated-schema-components-schemas-ModelAssetClass-properties-name + type: object + ModelAssetClassDetails: + additionalProperties: true + properties: + model_asset_class: + $ref: '#/components/schemas/ModelAssetClass' + model_asset_class_target: + items: + $ref: '#/components/schemas/ModelAssetClassTarget' + type: array + type: object + ModelAssetClassTarget: + additionalProperties: true + properties: + symbol: + $ref: '#/components/schemas/UniversalSymbol' + type: object + ModelPortfolio: + additionalProperties: true + properties: + id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + name: + example: SnapTrade 5x Aggressive Growth Fund + type: string + x-konfig-original-example: SnapTrade 5x Aggressive Growth Fund + x-konfig-generated-schema: konfig-generated-schema-components-schemas-ModelPortfolio-properties-name + model_type: + default: -1 + description: "Enum definitions -> [-1: Unassigned, 0: Security Model Portfolio,\ + \ 1: Asset Class Portfolio]" + enum: + - -1 + - 0 + - 1 + example: -1 + type: integer + x-konfig-original-example: -1 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-ModelPortfolio-properties-model_type + type: object + ModelPortfolioAssetClass: + additionalProperties: true + properties: + model_asset_class: + $ref: '#/components/schemas/ModelAssetClass' + percent: + example: 100 + maximum: 100 + minimum: 0 + type: integer + x-konfig-original-example: 100 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-ModelPortfolioAssetClass-properties-percent + type: object + ModelPortfolioDetails: + additionalProperties: true + properties: + model_portfolio: + $ref: '#/components/schemas/ModelPortfolio' + model_portfolio_security: + items: + $ref: '#/components/schemas/ModelPortfolioSecurity' + type: array + model_portfolio_asset_class: + items: + $ref: '#/components/schemas/ModelPortfolioAssetClass' + type: array + type: object + ModelPortfolioSecurity: + additionalProperties: true + properties: + symbol: + $ref: '#/components/schemas/UniversalSymbol' + percent: + example: 100 + maximum: 100 + minimum: 0 + type: integer + x-konfig-original-example: 100 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-ModelPortfolioSecurity-properties-percent + type: object + MonthlyDividends: + additionalProperties: true + example: + date: 2022-01-24T00:00:00.000+00:00 + dividends: + - symbol: AAPL + amount: 6.82 + currency: CAD + - symbol: AAPL + amount: 6.82 + currency: CAD + properties: + date: + description: Date used to specify timeframe for a reporting call (in YYYY-MM-DD + format) + example: 2022-01-24 + format: date + type: string + x-konfig-original-example: 2022-01-24 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-ReportingDate + dividends: + items: + $ref: '#/components/schemas/DividendAtDate' + type: array + type: object + NetContributions: + additionalProperties: true + example: + date: 2022-01-24T00:00:00.000+00:00 + contributions: 524.74 + currency: CAD + properties: + date: + description: Date used to specify timeframe for a reporting call (in YYYY-MM-DD + format) + example: 2022-01-24 + format: date + type: string + x-konfig-original-example: 2022-01-24 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-ReportingDate + contributions: + example: 524.74 + nullable: true + type: number + x-konfig-original-example: 524.74 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-NetContributions-properties-contributions + currency: + example: CAD + type: string + x-konfig-original-example: CAD + x-konfig-generated-schema: konfig-generated-schema-components-schemas-NetContributions-properties-currency + type: object + NetDividend: + additionalProperties: true + description: Object representing total dividends received during a timeframe + example: + symbol: + figi_code: BBG000B9XRY4 + symbol: VAB.TO + figi_instrument: + figi_code: BBG000B9Y5X2 + figi_share_class: BBG001S5N8V8 + raw_symbol: VAB + description: VANGUARD CDN AGGREGATE BOND INDEX ETF + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + exchange: + start_time: 09:30:00 + mic_code: XTSE + code: TSX + timezone: America/New_York + name: Toronto Stock Exchange + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + close_time: "57600" + suffix: .TO + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: + is_supported: true + code: cs + description: Common Stock + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + currencies: + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + amount: 165.05 + currency: USD + properties: + symbol: + $ref: '#/components/schemas/UniversalSymbol' + amount: + example: 165.05 + nullable: true + type: number + x-konfig-original-example: 165.05 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-NetDividend-properties-amount + currency: + example: USD + type: string + x-konfig-original-example: USD + x-konfig-generated-schema: konfig-generated-schema-components-schemas-NetDividend-properties-currency + type: object + PastValue: + additionalProperties: true + example: + date: 2022-01-24T00:00:00.000+00:00 + currency: CAD + value: 52.74 + properties: + date: + description: Date used to specify timeframe for a reporting call (in YYYY-MM-DD + format) + example: 2022-01-24 + format: date + type: string + x-konfig-original-example: 2022-01-24 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-ReportingDate + value: + example: 52.74 + type: number + x-konfig-original-example: 52.74 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-PastValue-properties-value + currency: + example: CAD + type: string + x-konfig-original-example: CAD + x-konfig-generated-schema: konfig-generated-schema-components-schemas-PastValue-properties-currency + type: object + Percent: + example: 90 + maximum: 100 + minimum: 0 + type: number + x-konfig-original-example: 90 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Percent + PortfolioGroupID: + deprecated: true + description: Portfolio Group ID. Portfolio Groups have been deprecated. Please + contact support if you have a usecase for it. + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-PortfolioGroupID + PortfolioGroup: + additionalProperties: true + properties: + id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + name: + example: Combined Retirement Portfolio + type: string + x-konfig-original-example: Combined Retirement Portfolio + x-konfig-generated-schema: konfig-generated-schema-components-schemas-PortfolioGroup-properties-name + type: object + PortfolioGroupInfo: + additionalProperties: true + description: Summary of all relevant information about a portfolio group. + properties: + symbols: + items: + $ref: '#/components/schemas/UniversalSymbol' + type: array + quotable_symbols: + items: + $ref: '#/components/schemas/UniversalSymbol' + type: array + balances: + items: + $ref: '#/components/schemas/Balance' + type: array + positions: + items: + $ref: '#/components/schemas/Position' + type: array + target_positions: + items: + $ref: '#/components/schemas/TargetAsset' + type: array + ideal_positions: + items: + $ref: '#/components/schemas/Position' + type: array + excluded_positions: + items: + $ref: '#/components/schemas/ExcludedAsset' + type: array + calculated_trades: + items: + $ref: '#/components/schemas/CalculatedTrade' + type: array + brokerage_authorizations: + items: + $ref: '#/components/schemas/BrokerageAuthorization' + type: array + accuracy: + example: 0.962 + type: number + x-konfig-original-example: 0.962 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-PortfolioGroupInfo-properties-accuracy + settings: + $ref: '#/components/schemas/PortfolioGroupSettings' + type: object + PortfolioGroupPosition: + additionalProperties: true + description: Details of a security held + properties: + symbol: + $ref: '#/components/schemas/UniversalSymbol' + price: + description: Last known market price for the symbol + example: 24.81 + nullable: true + type: number + x-konfig-original-example: 24.81 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-PortfolioGroupPosition-properties-price + units: + example: 15 + type: integer + x-konfig-original-example: 15 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-PortfolioGroupPosition-properties-units + type: object + PortfolioGroupSettings: + additionalProperties: true + properties: + buyOnly: + example: true + type: boolean + x-konfig-original-example: true + x-konfig-generated-schema: konfig-generated-schema-components-schemas-PortfolioGroupSettings-properties-buyOnly + cash_optimizer: + example: true + type: boolean + x-konfig-original-example: true + x-konfig-generated-schema: konfig-generated-schema-components-schemas-PortfolioGroupSettings-properties-cash_optimizer + notifyFrequency: + example: 7 00:00:00 + type: string + x-konfig-original-example: 7 00:00:00 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-PortfolioGroupSettings-properties-notifyFrequency + driftThreshold: + example: 90 + maximum: 100 + minimum: 0 + type: number + x-konfig-original-example: 90 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Percent + preferred_currency: + $ref: '#/components/schemas/Currency' + type: object + ReportingDate: + description: Date used to specify timeframe for a reporting call (in YYYY-MM-DD + format) + example: 2022-01-24 + format: date + type: string + x-konfig-original-example: 2022-01-24 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-ReportingDate + ReportingFrequency: + description: "Optional frequency for the rate of return chart (defaults to monthly).\ + \ Possible values are weekly, monthly, quarterly, yearly." + example: monthly + type: string + x-konfig-original-example: monthly + x-konfig-generated-schema: konfig-generated-schema-components-schemas-ReportingFrequency + Status: + additionalProperties: true + description: Status of API + example: + online: true + version: 151 + timestamp: 2022-11-04T01:47:00.377Z + properties: + version: + example: 151 + type: integer + x-konfig-original-example: 151 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Status-properties-version + timestamp: + example: 2022-11-04T01:47:00.377Z + type: string + x-konfig-original-example: 2022-11-04T01:47:00.377Z + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Status-properties-timestamp + online: + example: true + type: boolean + x-konfig-original-example: true + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Status-properties-online + type: object + x-konfig-is-used-in-successful-response: true + SymbolQuery: + description: Symbol query for searching for symbols + example: + substring: apple + properties: + substring: + example: apple + type: string + x-konfig-original-example: apple + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SymbolQuery-properties-substring + type: object + SyncStatusDate: + description: Date in YYYY-MM-DD format or null + example: 2022-01-24 + format: date + nullable: true + type: string + x-konfig-original-example: 2022-01-24 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SyncStatusDate + HoldingsSyncStatusDate: + description: Date in ISO 8601 format or null (YYYY-MM-DD HH:MM:SS.mmmmmmTZ) + example: 2024-06-28 18:42:46.561408+00:00 + format: datetime + nullable: true + type: string + x-konfig-original-example: 2024-06-28 18:42:46.561408+00:00 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-HoldingsSyncStatusDate + TargetAsset: + additionalProperties: true + description: Target percentage of a certain asset + properties: + id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + symbol: + $ref: '#/components/schemas/UniversalSymbol' + percent: + example: 90 + maximum: 100 + minimum: 0 + type: number + x-konfig-original-example: 90 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Percent + is_supported: + example: true + type: boolean + x-konfig-original-example: true + x-konfig-generated-schema: konfig-generated-schema-components-schemas-TargetAsset-properties-is_supported + is_excluded: + example: true + type: boolean + x-konfig-original-example: true + x-konfig-generated-schema: konfig-generated-schema-components-schemas-TargetAsset-properties-is_excluded + meta: + additionalProperties: true + nullable: true + type: object + type: object + TargetAssetList: + description: Target percentage of a certain asset + items: + $ref: '#/components/schemas/TargetAsset' + type: array + Trade: + additionalProperties: true + description: A trade object + properties: + id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + account: + $ref: '#/components/schemas/Account' + symbol: + $ref: '#/components/schemas/BrokerageSymbol' + universal_symbol: + $ref: '#/components/schemas/UniversalSymbol' + action: + enum: + - BUY + - SELL + example: BUY + type: string + x-konfig-original-example: BUY + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Trade-properties-action + units: + example: 6 + type: integer + x-konfig-original-example: 6 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Trade-properties-units + price: + example: 24.81 + type: number + x-konfig-original-example: 24.81 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Trade-properties-price + sequence: + example: 1 + type: integer + x-konfig-original-example: 1 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Trade-properties-sequence + type: object + TradeExecutionStatus: + additionalProperties: true + description: Execution status of a trade + properties: + symbol: + $ref: '#/components/schemas/BrokerageSymbol' + universal_symbol: + $ref: '#/components/schemas/UniversalSymbol' + trade: + $ref: '#/components/schemas/Trade' + state: + description: Execution state of a trade + enum: + - Executed + - Canceled + - Rejected + - Failed + - Not Executed + example: Executed + type: string + x-konfig-original-example: Executed + x-konfig-generated-schema: konfig-generated-schema-components-schemas-TradeExecutionStatus-properties-state + filled_units: + description: Number of filled units + example: 3 + type: integer + x-konfig-original-example: 3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-TradeExecutionStatus-properties-filled_units + action: + description: Action of executed trade + enum: + - BUY + - SELL + example: SELL + type: string + x-konfig-original-example: SELL + x-konfig-generated-schema: konfig-generated-schema-components-schemas-TradeExecutionStatus-properties-action + price: + description: Price of execution + example: 23.44 + type: number + x-konfig-original-example: 23.44 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-TradeExecutionStatus-properties-price + commissions: + description: Fees paid from executing trade + example: 23.44 + type: number + x-konfig-original-example: 23.44 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-TradeExecutionStatus-properties-commissions + meta: + additionalProperties: true + description: Other misc. data + example: + canceledUnits: 2 + type: object + x-konfig-original-example: + canceledUnits: 2 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-TradeExecutionStatus-properties-meta + type: object + TradeImpact: + additionalProperties: true + description: Impact of a group of trade + properties: + account: + $ref: '#/components/schemas/Account' + currency: + $ref: '#/components/schemas/Currency' + remaining_cash: + description: Remaining balance after executing all trades + example: 1.01 + type: number + x-konfig-original-example: 1.01 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-TradeImpact-properties-remaining_cash + estimated_commissions: + description: Total estimated commissions across all trades to make + example: 10.05 + type: number + x-konfig-original-example: 10.05 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-TradeImpact-properties-estimated_commissions + forex_fees: + description: Estimated forex fees to pay to excute trades + example: 2.01 + type: number + x-konfig-original-example: 2.01 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-TradeImpact-properties-forex_fees + type: object + ManualTrade: + additionalProperties: true + description: A manual trade object + example: + symbol: + universal_symbol_id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + symbol: MVGP.U.TO + brokerage_symbol_id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + local_id: "1048101" + description: Metaverse Global ETF + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + time_in_force: time_in_force + price: 31.33 + action: null + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + units: 0.8008281904610115 + order_type: null + account: 2bcd7cc3-e922-4976-bce1-9855556801c3 + properties: + id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + account: + example: 2bcd7cc3-e922-4976-bce1-9855556801c3 + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9855556801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-ManualTrade-properties-account + order_type: + $ref: '#/components/schemas/OrderTypeStrict' + time_in_force: + description: | + Trade time in force examples: + * FOK - Fill Or Kill + * Day - Day + * GTC - Good Til Canceled + * GTD - Good Til Date + type: string + symbol: + $ref: '#/components/schemas/ManualTradeSymbol' + action: + $ref: '#/components/schemas/ActionStrict' + units: + description: Trade Units. Cannot work with notional value. + nullable: true + type: number + price: + description: Trade Price if limit or stop limit order + example: 31.33 + nullable: true + type: number + x-konfig-original-example: 31.33 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Price + type: object + ManualTradeSymbol: + additionalProperties: true + description: Manual trade symbol object + example: + universal_symbol_id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + symbol: MVGP.U.TO + brokerage_symbol_id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + local_id: "1048101" + description: Metaverse Global ETF + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + properties: + brokerage_symbol_id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + universal_symbol_id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + currency: + $ref: '#/components/schemas/Currency' + local_id: + example: "1048101" + type: string + x-konfig-original-example: "1048101" + x-konfig-generated-schema: konfig-generated-schema-components-schemas-ManualTradeSymbol-properties-local_id + description: + example: Metaverse Global ETF + nullable: true + type: string + x-konfig-original-example: Metaverse Global ETF + x-konfig-generated-schema: konfig-generated-schema-components-schemas-ManualTradeSymbol-properties-description + symbol: + example: MVGP.U.TO + type: string + x-konfig-original-example: MVGP.U.TO + x-konfig-generated-schema: konfig-generated-schema-components-schemas-ManualTradeSymbol-properties-symbol + type: object + ManualTradeBalance: + additionalProperties: true + description: Balance + example: + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + cash: 1.11 + account: + number: Q6542138443 + balance: + total: + amount: 15363.23 + currency: USD + brokerage_authorization: 2bcd7cc3-e922-4976-bce1-9858296801c3 + meta: + type: Margin + status: ACTIVE + institution_name: Alpaca + name: Registered Retirement Savings Account + sync_status: + holdings: + last_successful_sync: 2024-06-28 18:42:46.561408+00:00 + initial_sync_completed: true + transactions: + last_successful_sync: 2022-01-24T00:00:00.000+00:00 + initial_sync_completed: true + first_transaction_date: 2022-01-24T00:00:00.000+00:00 + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + portfolio_group: 2bcd7cc3-e922-4976-bce1-9858296801c3 + created_date: 2021-06-04T16:26:46.523Z + institution_name: Alpaca + cash_restrictions: + - amount: 100 + currency: 2bcd7cc3-e922-4976-bce1-9858296801c3 + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: ALLOCATE_MAX + account: 2bcd7cc3-e922-4976-bce1-9858296801c3 + - amount: 100 + currency: 2bcd7cc3-e922-4976-bce1-9858296801c3 + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: ALLOCATE_MAX + account: 2bcd7cc3-e922-4976-bce1-9858296801c3 + properties: + account: + $ref: '#/components/schemas/Account' + currency: + $ref: '#/components/schemas/Currency' + cash: + description: Cash + example: 1.11 + nullable: true + type: number + x-konfig-original-example: 1.11 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Cash + type: object + ManualTradeAndImpact: + additionalProperties: true + description: Manual Trade and Impact object + example: + trade: + symbol: + universal_symbol_id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + symbol: MVGP.U.TO + brokerage_symbol_id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + local_id: "1048101" + description: Metaverse Global ETF + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + time_in_force: time_in_force + price: 31.33 + action: null + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + units: 0.8008281904610115 + order_type: null + account: 2bcd7cc3-e922-4976-bce1-9855556801c3 + trade_impacts: + - symbol: + universal_symbol_id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + symbol: MVGP.U.TO + brokerage_symbol_id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + local_id: "1048101" + description: Metaverse Global ETF + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + time_in_force: time_in_force + price: 31.33 + action: null + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + units: 0.8008281904610115 + order_type: null + account: 2bcd7cc3-e922-4976-bce1-9855556801c3 + - symbol: + universal_symbol_id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + symbol: MVGP.U.TO + brokerage_symbol_id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + local_id: "1048101" + description: Metaverse Global ETF + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + time_in_force: time_in_force + price: 31.33 + action: null + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + units: 0.8008281904610115 + order_type: null + account: 2bcd7cc3-e922-4976-bce1-9855556801c3 + combined_remaining_balance: + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + cash: 1.11 + account: + number: Q6542138443 + balance: + total: + amount: 15363.23 + currency: USD + brokerage_authorization: 2bcd7cc3-e922-4976-bce1-9858296801c3 + meta: + type: Margin + status: ACTIVE + institution_name: Alpaca + name: Registered Retirement Savings Account + sync_status: + holdings: + last_successful_sync: 2024-06-28 18:42:46.561408+00:00 + initial_sync_completed: true + transactions: + last_successful_sync: 2022-01-24T00:00:00.000+00:00 + initial_sync_completed: true + first_transaction_date: 2022-01-24T00:00:00.000+00:00 + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + portfolio_group: 2bcd7cc3-e922-4976-bce1-9858296801c3 + created_date: 2021-06-04T16:26:46.523Z + institution_name: Alpaca + cash_restrictions: + - amount: 100 + currency: 2bcd7cc3-e922-4976-bce1-9858296801c3 + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: ALLOCATE_MAX + account: 2bcd7cc3-e922-4976-bce1-9858296801c3 + - amount: 100 + currency: 2bcd7cc3-e922-4976-bce1-9858296801c3 + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: ALLOCATE_MAX + account: 2bcd7cc3-e922-4976-bce1-9858296801c3 + properties: + trade: + $ref: '#/components/schemas/ManualTrade' + trade_impacts: + items: + $ref: '#/components/schemas/ManualTrade' + type: array + combined_remaining_balance: + $ref: '#/components/schemas/ManualTradeBalance' + type: object + x-konfig-is-used-in-successful-response: true + SymbolsQuotes: + description: Symbols and Tickers Quotes object + items: + $ref: '#/components/schemas/SymbolsQuotes_inner' + type: array + x-konfig-is-used-in-successful-response: true + ManualTradeForm: + description: Manual Trade Form + example: + universal_symbol_id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + time_in_force: null + account_id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + stop: 31.33 + price: 31.33 + notional_value: "" + action: null + units: 0.8008281904610115 + order_type: null + properties: + account_id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + action: + $ref: '#/components/schemas/ActionStrict' + order_type: + $ref: '#/components/schemas/OrderTypeStrict' + price: + description: Trade Price if limit or stop limit order + example: 31.33 + nullable: true + type: number + x-konfig-original-example: 31.33 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Price + stop: + description: "Stop Price. If stop loss or stop limit order, the price to\ + \ trigger the stop" + example: 31.33 + nullable: true + type: number + x-konfig-original-example: 31.33 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StopPrice + time_in_force: + $ref: '#/components/schemas/TimeInForceStrict' + units: + description: Trade Units. Cannot work with notional value. + nullable: true + type: number + universal_symbol_id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + notional_value: {} + type: object + x-konfig-properties: + notional_value: + nullable: true + ValidatedTradeBody: + description: Validated Trade Form + example: + wait_to_confirm: true + properties: + wait_to_confirm: + description: "Optional, defaults to true. Determines if a wait is performed\ + \ to check on order status. If false, latency will be reduced but orders\ + \ returned will be more likely to be of status PENDING as we will not\ + \ wait to check on the status before responding to the request" + example: true + nullable: true + type: boolean + x-konfig-original-example: true + x-konfig-generated-schema: konfig-generated-schema-components-schemas-ValidatedTradeBody-properties-wait_to_confirm + type: object + Cash: + description: Cash + example: 1.11 + nullable: true + type: number + x-konfig-original-example: 1.11 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Cash + OrderTypeStrict: + description: Order Type + enum: + - Limit + - Market + - StopLimit + - StopLoss + type: string + OrderType: + description: Order Type potential values include (but are not limited to) - + Limit - Market - StopLimit - StopLoss + nullable: true + type: string + SnapTradeAPIDisclaimerAcceptStatus: + additionalProperties: true + description: Status of user acceptance of SnapTrade API disclaimer + properties: + accepted: + type: boolean + timestamp: + example: 2022-01-21T20:11:19.217Z + type: string + x-konfig-original-example: 2022-01-21T20:11:19.217Z + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SnapTradeAPIDisclaimerAcceptStatus-properties-timestamp + type: object + TimeInForceStrict: + description: | + Trade time in force examples: + * FOK - Fill Or Kill + * Day - Day + * GTC - Good Til Canceled + enum: + - FOK + - Day + - GTC + type: string + TimeInForce: + description: | + Trade time in force examples: + * FOK - Fill Or Kill + * Day - Day + * GTC - Good Til Canceled + * GTD - Good Til Date + type: string + ActionStrict: + description: Trade Action + enum: + - BUY + - SELL + type: string + Action: + description: Trade Action potential values include (but are not limited to) + - BUY - SELL - BUY_COVER - SELL_SHORT - BUY_OPEN - BUY_CLOSE - SELL_OPEN - + SELL_CLOSE + type: string + Units: + description: Trade Units. Cannot work with notional value. + type: number + OpenUnits: + description: Trade Units + nullable: true + type: number + CancelledUnits: + description: Trade Units + nullable: true + type: number + FilledUnits: + description: Trade Units + nullable: true + type: number + Price: + description: Trade Price if limit or stop limit order + example: 31.33 + nullable: true + type: number + x-konfig-original-example: 31.33 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Price + NotionalValue: {} + StopPrice: + description: "Stop Price. If stop loss or stop limit order, the price to trigger\ + \ the stop" + example: 31.33 + nullable: true + type: number + x-konfig-original-example: 31.33 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StopPrice + UniversalActivity: + additionalProperties: true + description: A transaction or activity from an institution + example: + symbol: + figi_code: BBG000B9XRY4 + symbol: VAB.TO + figi_instrument: + figi_code: BBG000B9Y5X2 + figi_share_class: BBG001S5N8V8 + raw_symbol: VAB + name: Vanguard Canadian Aggregate Bond Index ETF + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + exchange: + start_time: 09:30:00 + mic_code: XTSE + code: TSX + timezone: America/New_York + name: Toronto Stock Exchange + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + close_time: "57600" + suffix: .TO + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: + is_supported: true + code: cs + description: Common Stock + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + amount: 263.82 + settlement_date: 2022-01-06T05:00:00.000Z + option_type: BUY_TO_OPEN + fee: 0 + description: WALT DISNEY UNIT DIST ON 21 SHS REC 12/31/21 PAY 01/06/22 + external_reference_id: 2f7dc9b3-5c33-4668-3440-2b31e056ebe6 + units: 5 + type: type + trade_date: 2022-01-06T05:00:00.000Z + institution: SnapTrade Investr + price: 0.4 + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + id: 2f7dc9b3-5c33-4668-3440-2b31e056ebe6 + fx_rate: 1.032 + option_symbol: + ticker: SPY 220819P00200000 + exchange_id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 + local_id: "40817960" + is_mini_option: false + option_type: CALL + underlying_symbol: + figi_code: BBG000B9XRY4 + symbol: SPY + figi_instrument: + figi_code: BBG000B9Y5X2 + figi_share_class: BBG001S5N8V8 + description: SPDR S&P 500 ETF Trust + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + exchange: + start_time: 09:30:00 + mic_code: ARCA + code: ARCX + timezone: America/New_York + name: NYSE ARCA + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + close_time: "57600" + suffix: None + allows_cryptocurrency_symbols: false + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: + is_supported: true + code: cs + description: Common Stock + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + currencies: + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + expiration_date: 2017-07-17T15:13:07.177712+00:00 + strike_price: 200 + account: + number: Q6542138443 + name: Registered Retirement Savings Account + sync_status: + holdings: + last_successful_sync: 2024-06-28 18:42:46.561408+00:00 + initial_sync_completed: true + transactions: + last_successful_sync: 2022-01-24T00:00:00.000+00:00 + initial_sync_completed: true + first_transaction_date: 2022-01-24T00:00:00.000+00:00 + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + properties: + id: + example: 2f7dc9b3-5c33-4668-3440-2b31e056ebe6 + type: string + x-konfig-original-example: 2f7dc9b3-5c33-4668-3440-2b31e056ebe6 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-UniversalActivity-properties-id + account: + $ref: '#/components/schemas/AccountSimple' + amount: + example: 263.82 + nullable: true + type: number + x-konfig-original-example: 263.82 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-UniversalActivity-properties-amount + currency: + $ref: '#/components/schemas/Currency' + description: + example: WALT DISNEY UNIT DIST ON 21 SHS REC 12/31/21 PAY 01/06/22 + type: string + x-konfig-original-example: WALT DISNEY UNIT DIST ON 21 SHS REC 12/31/21 + PAY 01/06/22 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-UniversalActivity-properties-description + fee: + example: 0 + type: number + x-konfig-original-example: 0 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-UniversalActivity-properties-fee + fx_rate: + description: "The forex conversion rate involved in the transaction if provided\ + \ by the brokerage. Used in cases where securities of one currency are\ + \ purchased in a different currency, and the forex conversion is automatic.\ + \ In those cases, price, amount and fee will be in the top level currency\ + \ (activity -> currency)" + example: 1.032 + nullable: true + type: number + x-konfig-original-example: 1.032 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-UniversalActivity-properties-fx_rate + institution: + example: SnapTrade Investr + type: string + x-konfig-original-example: SnapTrade Investr + x-konfig-generated-schema: konfig-generated-schema-components-schemas-UniversalActivity-properties-institution + option_type: + description: "If an option transaction, then it's type (BUY_TO_OPEN, SELL_TO_CLOSE,\ + \ etc), otherwise empty string" + example: BUY_TO_OPEN + type: string + x-konfig-original-example: BUY_TO_OPEN + x-konfig-generated-schema: konfig-generated-schema-components-schemas-UniversalActivity-properties-option_type + price: + example: 0.4 + type: number + x-konfig-original-example: 0.4 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-UniversalActivity-properties-price + settlement_date: + example: 2022-01-06T05:00:00.000Z + type: string + x-konfig-original-example: 2022-01-06T05:00:00.000Z + x-konfig-generated-schema: konfig-generated-schema-components-schemas-UniversalActivity-properties-settlement_date + external_reference_id: + description: "Reference ID from brokerage used to identify related transactions.\ + \ For example if an order comprises of several transactions (buy, fee,\ + \ fx), they can be grouped if they share the same external_reference_id" + example: 2f7dc9b3-5c33-4668-3440-2b31e056ebe6 + nullable: true + type: string + x-konfig-original-example: 2f7dc9b3-5c33-4668-3440-2b31e056ebe6 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-UniversalActivity-properties-external_reference_id + symbol: + $ref: '#/components/schemas/Symbol' + option_symbol: + $ref: '#/components/schemas/OptionsSymbol' + trade_date: + example: 2022-01-06T05:00:00.000Z + nullable: true + type: string + x-konfig-original-example: 2022-01-06T05:00:00.000Z + x-konfig-generated-schema: konfig-generated-schema-components-schemas-UniversalActivity-properties-trade_date + type: + description: Potential values include (but are not limited to) - DIVIDEND + - BUY - SELL - CONTRIBUTION - WITHDRAWAL - EXTERNAL_ASSET_TRANSFER_IN + - EXTERNAL_ASSET_TRANSFER_OUT - INTERNAL_CASH_TRANSFER_IN - INTERNAL_CASH_TRANSFER_OUT + - INTERNAL_ASSET_TRANSFER_IN - INTERNAL_ASSET_TRANSFER_OUT - INTEREST + - REBATE - GOV_GRANT - TAX - FEE - REI - FXT + type: string + units: + description: Usually but not necessarily an integer + example: 5 + type: number + x-konfig-original-example: 5 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-UniversalActivity-properties-units + type: object + FigiInstrument: + additionalProperties: true + description: Open FIGI Identifiers + properties: + figi_code: + example: BBG000B9Y5X2 + nullable: true + type: string + x-konfig-original-example: BBG000B9Y5X2 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-FigiInstrument-properties-figi_code + figi_share_class: + example: BBG001S5N8V8 + nullable: true + type: string + x-konfig-original-example: BBG001S5N8V8 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-FigiInstrument-properties-figi_share_class + type: object + UniversalSymbol: + additionalProperties: true + description: Universal symbol + example: + figi_code: BBG000B9XRY4 + symbol: VAB.TO + figi_instrument: + figi_code: BBG000B9Y5X2 + figi_share_class: BBG001S5N8V8 + raw_symbol: VAB + description: VANGUARD CDN AGGREGATE BOND INDEX ETF + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + exchange: + start_time: 09:30:00 + mic_code: XTSE + code: TSX + timezone: America/New_York + name: Toronto Stock Exchange + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + close_time: "57600" + suffix: .TO + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: + is_supported: true + code: cs + description: Common Stock + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + currencies: + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + properties: + id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + symbol: + example: VAB.TO + type: string + x-konfig-original-example: VAB.TO + x-konfig-generated-schema: konfig-generated-schema-components-schemas-UniversalSymbol-properties-symbol + raw_symbol: + example: VAB + type: string + x-konfig-original-example: VAB + x-konfig-generated-schema: konfig-generated-schema-components-schemas-UniversalSymbol-properties-raw_symbol + description: + example: VANGUARD CDN AGGREGATE BOND INDEX ETF + nullable: true + type: string + x-konfig-original-example: VANGUARD CDN AGGREGATE BOND INDEX ETF + x-konfig-generated-schema: konfig-generated-schema-components-schemas-UniversalSymbol-properties-description + currency: + $ref: '#/components/schemas/Currency' + exchange: + $ref: '#/components/schemas/Exchange' + type: + $ref: '#/components/schemas/SecurityType' + currencies: + items: + $ref: '#/components/schemas/Currency' + type: array + figi_code: + example: BBG000B9XRY4 + nullable: true + type: string + x-konfig-original-example: BBG000B9XRY4 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-UniversalSymbol-properties-figi_code + figi_instrument: + $ref: '#/components/schemas/FigiInstrumentNullable' + required: + - currencies + - currency + - id + - raw_symbol + - symbol + - type + type: object + x-konfig-is-used-in-successful-response: true + UnderlyingSymbol: + additionalProperties: true + description: Underlying Symbol + example: + figi_code: BBG000B9XRY4 + symbol: SPY + figi_instrument: + figi_code: BBG000B9Y5X2 + figi_share_class: BBG001S5N8V8 + description: SPDR S&P 500 ETF Trust + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + exchange: + start_time: 09:30:00 + mic_code: ARCA + code: ARCX + timezone: America/New_York + name: NYSE ARCA + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + close_time: "57600" + suffix: None + allows_cryptocurrency_symbols: false + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: + is_supported: true + code: cs + description: Common Stock + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + currencies: + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + properties: + id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + symbol: + example: SPY + type: string + x-konfig-original-example: SPY + x-konfig-generated-schema: konfig-generated-schema-components-schemas-UnderlyingSymbol-properties-symbol + description: + example: SPDR S&P 500 ETF Trust + nullable: true + type: string + x-konfig-original-example: SPDR S&P 500 ETF Trust + x-konfig-generated-schema: konfig-generated-schema-components-schemas-UnderlyingSymbol-properties-description + currency: + $ref: '#/components/schemas/Currency' + exchange: + $ref: '#/components/schemas/USExchange' + type: + $ref: '#/components/schemas/SecurityType' + currencies: + items: + $ref: '#/components/schemas/Currency' + type: array + figi_code: + example: BBG000B9XRY4 + nullable: true + type: string + x-konfig-original-example: BBG000B9XRY4 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-UnderlyingSymbol-properties-figi_code + figi_instrument: + $ref: '#/components/schemas/FigiInstrumentNullable' + type: object + OptionsSymbol: + additionalProperties: true + description: Options Symbol + example: + ticker: SPY 220819P00200000 + exchange_id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 + local_id: "40817960" + is_mini_option: false + option_type: CALL + underlying_symbol: + figi_code: BBG000B9XRY4 + symbol: SPY + figi_instrument: + figi_code: BBG000B9Y5X2 + figi_share_class: BBG001S5N8V8 + description: SPDR S&P 500 ETF Trust + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + exchange: + start_time: 09:30:00 + mic_code: ARCA + code: ARCX + timezone: America/New_York + name: NYSE ARCA + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + close_time: "57600" + suffix: None + allows_cryptocurrency_symbols: false + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: + is_supported: true + code: cs + description: Common Stock + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + currencies: + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + expiration_date: 2017-07-17T15:13:07.177712+00:00 + strike_price: 200 + properties: + id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + ticker: + example: SPY 220819P00200000 + type: string + x-konfig-original-example: SPY 220819P00200000 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-OptionsSymbol-properties-ticker + option_type: + enum: + - CALL + - PUT + example: CALL + type: string + x-konfig-original-example: CALL + x-konfig-generated-schema: konfig-generated-schema-components-schemas-OptionsSymbol-properties-option_type + strike_price: + example: 200 + type: number + x-konfig-original-example: 200 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-OptionsSymbol-properties-strike_price + expiration_date: + example: 2017-07-17T15:13:07.177712+00:00 + format: datetime + type: string + x-konfig-original-example: 2017-07-17T15:13:07.177712+00:00 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-OptionsSymbol-properties-expiration_date + is_mini_option: + example: false + type: boolean + x-konfig-original-example: false + x-konfig-generated-schema: konfig-generated-schema-components-schemas-OptionsSymbol-properties-is_mini_option + underlying_symbol: + $ref: '#/components/schemas/UnderlyingSymbol' + local_id: + example: "40817960" + type: string + x-konfig-original-example: "40817960" + x-konfig-generated-schema: konfig-generated-schema-components-schemas-OptionsSymbol-properties-local_id + exchange_id: + format: uuid + type: string + required: + - expiration_date + - id + - option_type + - strike_price + - ticker + - underlying_symbol + type: object + OptionLeg: + additionalProperties: true + description: Option Leg + properties: + action: + enum: + - BUY_TO_OPEN + - BUY_TO_CLOSE + - SELL_TO_OPEN + - SELL_TO_CLOSE + type: string + option_symbol_id: + description: Obtained from calling options chain endpoint (option_id) + example: SPY220819P00200000 + type: string + x-konfig-original-example: SPY220819P00200000 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-OptionLeg-properties-option_symbol_id + quantity: + example: 1 + type: number + x-konfig-original-example: 1 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-OptionLeg-properties-quantity + type: object + SecurityType: + additionalProperties: true + description: Security Type + example: + is_supported: true + code: cs + description: Common Stock + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + properties: + id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + code: + example: cs + type: string + x-konfig-original-example: cs + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SecurityType-properties-code + description: + example: Common Stock + type: string + x-konfig-original-example: Common Stock + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SecurityType-properties-description + is_supported: + example: true + type: boolean + x-konfig-original-example: true + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SecurityType-properties-is_supported + type: object + UserSettings: + additionalProperties: true + description: User account settings + properties: + email: + example: ops@snaptrade.com + format: email + type: string + x-konfig-original-example: ops@snaptrade.com + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Email + name: + example: James Bond + type: string + x-konfig-original-example: James Bond + x-konfig-generated-schema: konfig-generated-schema-components-schemas-UserSettings-properties-name + receive_cash_notification: + example: true + type: boolean + x-konfig-original-example: true + x-konfig-generated-schema: konfig-generated-schema-components-schemas-UserSettings-properties-receive_cash_notification + receive_drift_notification: + example: true + type: boolean + x-konfig-original-example: true + x-konfig-generated-schema: konfig-generated-schema-components-schemas-UserSettings-properties-receive_drift_notification + user_trial_activated: + example: true + type: boolean + x-konfig-original-example: true + x-konfig-generated-schema: konfig-generated-schema-components-schemas-UserSettings-properties-user_trial_activated + activated_trial_date: + example: 2017-07-17T15:13:07.177712+00:00 + format: dateTime + type: string + x-konfig-original-example: 2017-07-17T15:13:07.177712+00:00 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-UserSettings-properties-activated_trial_date + demo: + example: false + type: boolean + x-konfig-original-example: false + x-konfig-generated-schema: konfig-generated-schema-components-schemas-UserSettings-properties-demo + api_enabled: + example: false + type: boolean + x-konfig-original-example: false + x-konfig-generated-schema: konfig-generated-schema-components-schemas-UserSettings-properties-api_enabled + drift_threshold: + example: 95 + type: number + x-konfig-original-example: 95 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-UserSettings-properties-drift_threshold + preferred_currency: + $ref: '#/components/schemas/Currency' + type: object + Time: + description: Time + example: 2022-01-21T20:11:19.217Z + type: string + x-konfig-original-example: 2022-01-21T20:11:19.217Z + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Time + BrokerageType: + additionalProperties: true + description: Type of brokerage + example: + name: Traditional Brokerage + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + properties: + id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + name: + example: Traditional Brokerage + type: string + x-konfig-original-example: Traditional Brokerage + x-konfig-generated-schema: konfig-generated-schema-components-schemas-BrokerageType-properties-name + type: object + UserErrorLog: + additionalProperties: true + description: An API error log for a specific SnapTrade user. + properties: + requestedAt: + example: 2022-01-21T20:11:19.217Z + type: string + x-konfig-original-example: 2022-01-21T20:11:19.217Z + x-konfig-generated-schema: konfig-generated-schema-components-schemas-UserErrorLog-properties-requestedAt + response: + type: string + statusCode: + example: 200 + type: number + x-konfig-original-example: 200 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-UserErrorLog-properties-statusCode + queryParams: + type: string + httpMethod: + example: POST + type: string + x-konfig-original-example: POST + x-konfig-generated-schema: konfig-generated-schema-components-schemas-UserErrorLog-properties-httpMethod + endpoint: + example: api/v1/snapTrade + type: string + x-konfig-original-example: api/v1/snapTrade + x-konfig-generated-schema: konfig-generated-schema-components-schemas-UserErrorLog-properties-endpoint + type: object + rsaPublicKey: + description: Open SSH RSA public key + example: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQC7vbqajDw4o6gJy8UtmIbkcpnkO3Kwc4qsEnSZp/TR+fQi62F79RHWmwKOtFmwteURgLbj7D/WGuNLGOfa/2vse3G2eHnHl5CB8ruRX9fBl/KgwCVr2JaEuUm66bBQeP5XeBotdR4cvX38uPYivCDdPjJ1QWPdspTBKcxeFbccDw== + type: string + x-konfig-original-example: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQC7vbqajDw4o6gJy8UtmIbkcpnkO3Kwc4qsEnSZp/TR+fQi62F79RHWmwKOtFmwteURgLbj7D/WGuNLGOfa/2vse3G2eHnHl5CB8ruRX9fBl/KgwCVr2JaEuUm66bBQeP5XeBotdR4cvX38uPYivCDdPjJ1QWPdspTBKcxeFbccDw== + x-konfig-generated-schema: konfig-generated-schema-components-schemas-rsaPublicKey + encryptedResponse: + additionalProperties: false + description: | + This response consists of 2 different components that must be decrypted to obtain the decrypted message + + * Decrypting the encryptedSharedKey + + The encrypted shared key is a shared key that was randomly generated by SnapTrade and encrypted using the users SSH public key provided when registering the user + It is needed to decrypt the message in step 2. + + To decrypt the shared key, the user should have access to their SSH private key stored locally in their device + + An example Python code on how to decrypt the shared key is shown below + + ``` + def decrypt_rsa_message(self, encrypted_message): + from Crypto.Cipher import PKCS1_OAEP + from Crypto.PublicKey import RSA + from base64 import b64decode + + f = open('private.pem', 'r') + private_key = RSA.import_key(f.read()) + cipher = PKCS1_OAEP.new(private_key) + + return cipher.decrypt(b64decode(encrypted_message.encode())).decode() + ``` + + * Decrypting the encryptedMessageData + + The data meant to be returned by an endpoint can be obtained by decrypting the encrypted message + + An encrypted message is a message that is encrypted using AES - MODE OCB with the shared key obtained in step one + + An example code to decrypt the encrypted message is shown below + + ``` + def decrypt_aes_message(self, shared_key, encrypted_message): + from Crypto.Cipher import AES + from base64 import b64decode + + encrypted_msg = b64decode(encrypted_message["encryptedMessage"].encode()) + tag = b64decode(encrypted_message["tag"].encode()) + nonce = b64decode(encrypted_message["nonce"].encode()) + cipher = AES.new(shared_key.encode(), AES.MODE_OCB, nonce=nonce) + + return cipher.decrypt_and_verify(encrypted_msg, tag).decode() + ``` + properties: + encryptedSharedKey: + example: 5UEaY9QGzcNTr8y2jGDUI79jY1OdfK9x + type: string + x-konfig-original-example: 5UEaY9QGzcNTr8y2jGDUI79jY1OdfK9x + x-konfig-generated-schema: konfig-generated-schema-components-schemas-encryptedResponse-properties-encryptedSharedKey + encryptedMessageData: + $ref: '#/components/schemas/encryptedResponse_encryptedMessageData' + type: object + konfig-generated-schema-paths--holdings-get-parameters-2-schema: + example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + type: string + x-do-not-generate: true + konfig-generated-schema-paths--accounts-accountId-get-parameters-2-schema: + example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + type: string + x-do-not-generate: true + konfig-generated-schema-paths--accounts-accountId-balances-get-parameters-2-schema: + example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + type: string + x-do-not-generate: true + konfig-generated-schema-paths--accounts-accountId-positions-get-parameters-2-schema: + example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + type: string + x-do-not-generate: true + konfig-generated-schema-paths--accounts-accountId-orders-get-parameters-3-schema: + example: 30 + type: number + x-do-not-generate: true + konfig-generated-schema-paths--accounts-accountId-orders-get-parameters-4-schema: + example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + type: string + x-do-not-generate: true + konfig-generated-schema-paths--accounts-accountId-quotes-get-parameters-4-schema: + example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + type: string + x-do-not-generate: true + konfig-generated-schema-paths--accounts-accountId-orders-cancel-post-parameters-2-schema: + example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + type: string + x-do-not-generate: true + konfig-generated-schema-paths--accounts-accountId-symbols-post-parameters-2-schema: + example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + type: string + x-do-not-generate: true + konfig-generated-schema-paths--brokerageAuthorizationTypes-get-parameters-0-schema: + example: "QUESTRADE,ALPACA" + type: string + x-do-not-generate: true + konfig-generated-schema-paths--activities-get-parameters-4-schema: + example: DIVIDEND + type: string + x-do-not-generate: true + konfig-generated-schema-paths--performance-custom-get-parameters-3-schema: + example: true + type: boolean + x-do-not-generate: true + konfig-generated-schema-components-requestBodies-MockSignatureRequestBody-content-application-json-schema: + additionalProperties: true + example: + userId: snaptrade-user-123 + userSecret: CHRIS.P.BACON + properties: + userId: + example: snaptrade-user-123 + type: string + userSecret: + example: CHRIS.P.BACON + type: string + type: object + x-do-not-generate: true + konfig-generated-schema-components-schemas-CashRestriction-properties-amount: + example: 100 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-Amount-properties-amount: + example: 15363.23 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-Amount-properties-currency: + example: USD + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-Account-properties-name: + example: Registered Retirement Savings Account + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-Account-properties-number: + example: Q6542138443 + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-Account-properties-institution_name: + example: Alpaca + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-Account-properties-created_date: + example: 2021-06-04T16:26:46.523Z + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-Account-properties-meta: + additionalProperties: true + example: + type: Margin + status: ACTIVE + institution_name: Alpaca + properties: + type: + example: Margin + type: string + status: + example: ACTIVE + type: string + institution_name: + example: Alpaca + type: string + type: object + x-do-not-generate: true + konfig-generated-schema-components-schemas-AccountSimple-properties-name: + example: Registered Retirement Savings Account + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-AccountSimple-properties-number: + example: Q6542138443 + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-AccountID: + example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-AccountIDs: + example: "917c8734-8470-4a3e-a18f-57c3f2ee6631,65e839a3-9103-4cfb-9b72-2071ef80c5f2" + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-BrokerageAuthID: + example: 87b24961-b51e-4db8-9226-f198f6518a89 + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-BrokerageAuthIDs: + example: "917c8734-8470-4a3e-a18f-57c3f2ee6631,65e839a3-9103-4cfb-9b72-2071ef80c5f2" + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-OptionsPosition-properties-price: + example: 113.15 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-OptionsPosition-properties-units: + example: 10 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-OptionsPosition-properties-average_purchase_price: + example: 108.3353 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyImpact-properties-estimatedCommissions: + example: 11.95 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyImpact-properties-buyingPowerEffect: + example: -156.3435 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyImpact-properties-buyingPowerResult: + example: 8800.0882 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyImpact-properties-maintExcessEffect: + example: -46.95 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyImpact-properties-maintExcessResult: + example: 2642.669129 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyImpact-properties-tradeValueCalculation: + example: 1 x 0.07 x 100 + 1 x 0.28 x 100 = DR 35.00 CAD + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyImpact-properties-legs-items-properties-legId: + example: 0 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyImpact-properties-legs-items-properties-symbol: + example: AC21Oct22C30.00.MX + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyImpact-properties-legs-items-properties-symbolId: + example: 41790511 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyImpact-properties-legs-items-properties-legRatioQuantity: + example: 1 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyImpact-properties-legs-items-properties-side: + example: BTO + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyImpact-properties-side: + example: Buy + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyImpact-properties-effect: + example: Debit + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyImpact-properties-price: + example: 0.35 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyImpact-properties-strategy: + example: Strangle + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orderId: + example: 1069605761 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-id: + example: 1069605761 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-symbol: + example: AC.TO + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-symbolId: + example: 7960447 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-totalQuantity: + example: 1 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-openQuantity: + example: 1 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-filledQuantity: + example: 0 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-canceledQuantity: + example: 0 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-side: + example: Buy + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-orderType: + example: Market + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-avgExecPrice: + example: 0 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-source: + example: TradingAPI + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-timeInForce: + example: Day + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-state: + example: Pending + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-rejectionReason: + example: None + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-chainId: + example: 1069605761 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-creationTime: + example: 2022-07-19T19:53:47.915Z + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-updateTime: + example: 2022-07-19T19:53:47.939Z + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-notes: + example: None + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-primaryRoute: + example: AUTO + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-secondaryRoute: + example: AUTO + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-orderRoute: + example: MX + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-venueHoldingOrder: + example: None + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-comissionCharged: + example: 0 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-exchangeOrderId: + example: None + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-userId: + example: 514603 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-legs-items-properties-legId: + example: 0 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-legs-items-properties-symbol: + example: AC21Oct22C30.00.MX + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-legs-items-properties-symbolId: + example: 41790511 + type: number + x-do-not-generate: true + ? konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-legs-items-properties-legRatioQuantity + : example: 1 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-legs-items-properties-side: + example: BTO + type: string + x-do-not-generate: true + ? konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-legs-items-properties-avgExecPrice + : example: 0 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-strategyType: + example: Strangle + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-orderGroupId: + example: 0 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-OptionStrategy-properties-strategy_type: + example: BUTTERFLY + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-OptionStrategy-properties-number_of_legs: + example: 2 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-OptionStrategy-properties-legs-items-properties-option_symbol_id: + example: AAPLC20221111 + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-OptionStrategy-properties-legs-items-properties-index: + example: 1 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-OptionStrategy-properties-legs-items-properties-action: + example: BUY_TO_OPEN + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-OptionStrategy-properties-legs-items-properties-quantity: + example: 10 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyQuotes-properties-volatility: + example: 0.141 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyQuotes-properties-greek-properties-delta: + example: 0.1 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyQuotes-properties-greek-properties-gamma: + example: 0.1 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyQuotes-properties-greek-properties-theta: + example: 0.1 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyQuotes-properties-greek-properties-vega: + example: 0.1 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyQuotes-properties-greek-properties-rho: + example: 0.1 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyOrderRecord-properties-filled_quantity: + example: 10 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyOrderRecord-properties-open_quantity: + example: 10 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-StrategyOrderRecord-properties-closed_quantity: + example: 10 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-SnapTradeHoldingsAccount-properties-name: + example: Registered Retirement Savings Account + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-SnapTradeHoldingsAccount-properties-number: + example: Q6542138443 + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-SnapTradeHoldingsAccount-properties-institution_name: + example: Alpaca + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-SnapTradeHoldingsAccount-properties-meta: + additionalProperties: true + example: + type: Margin + status: ACTIVE + institution_name: Alpaca + properties: + type: + example: Margin + type: string + status: + example: ACTIVE + type: string + institution_name: + example: Alpaca + type: string + type: object + x-do-not-generate: true + konfig-generated-schema-components-schemas-SnapTradeHoldingsAccountAccountId-properties-name: + example: Robinhood Individual + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-SnapTradeHoldingsAccountAccountId-properties-number: + example: Q6542138443 + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-SnapTradeHoldingsAccountAccountId-properties-institution_name: + example: Alpaca + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-SnapTradeHoldingsAccountAccountId-properties-meta: + additionalProperties: true + example: + type: Margin + status: ACTIVE + institution_name: Alpaca + properties: + type: + example: Margin + type: string + status: + example: ACTIVE + type: string + institution_name: + example: Alpaca + type: string + type: object + x-do-not-generate: true + konfig-generated-schema-components-schemas-SnapTradeHoldingsAccountAccountId-properties-created_date: + example: 2024-07-23T22:50:22.761Z + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-SnapTradeHoldingsTotalValue-properties-value: + example: 32600.71 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-SnapTradeHoldingsTotalValue-properties-currency: + example: USD + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-Balance-properties-cash: + example: 300.71 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-Balance-properties-buying_power: + example: 410.71 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-ConsumerKey: + example: UxrFb4cHdRWlmJKNuJjA6hoaN8uVa6jPGFVUl2UKHuKmurCnaU + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-Currency-properties-id: + example: 87b24961-b51e-4db8-9226-f198f6518a89 + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-Currency-properties-code: + example: USD + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-Currency-properties-name: + example: US Dollar + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-Exchange-properties-code: + example: TSX + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-Exchange-properties-mic_code: + example: XTSE + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-Exchange-properties-name: + example: Toronto Stock Exchange + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-Exchange-properties-timezone: + example: America/New_York + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-Exchange-properties-start_time: + example: 09:30:00 + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-Exchange-properties-close_time: + example: "57600" + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-Exchange-properties-suffix: + example: .TO + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-USExchange-properties-code: + example: ARCX + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-USExchange-properties-mic_code: + example: ARCA + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-USExchange-properties-name: + example: NYSE ARCA + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-USExchange-properties-timezone: + example: America/New_York + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-USExchange-properties-start_time: + example: 09:30:00 + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-USExchange-properties-close_time: + example: "57600" + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-USExchange-properties-suffix: + example: None + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-USExchange-properties-allows_cryptocurrency_symbols: + example: false + type: boolean + x-do-not-generate: true + konfig-generated-schema-components-schemas-JWT-properties-token: + example: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VybmFtZSI6ImZSbUdsbWFyU1dtZDY5RDkyeGZWbVdCWUxCS0x0QiIsImV4cCI6MTU0MDA1NTMxOSwiZW1haWwiOiJ3b29kQHN5bmNocm92ZXJnZS5jb20iLCJvcmlnX2lhdCI6MTUzNzM3NjkxOX0.ZSn85i3kSBvEP5wuhWOE8_w903N1G1AfiVlD3fmri78 + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-ClientID: + example: SNAPTRADETEST + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-UserID: + example: snaptrade-user-123 + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-UserSecret: + example: USERSECRET123 + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-PerformanceCustom-properties-contributionStreak: + example: 5 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-PerformanceCustom-properties-contributionMonthsContributed: + example: 10 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-PerformanceCustom-properties-contributionTotalMonths: + example: 13 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-PerformanceCustom-properties-dividendIncome: + example: 135.97 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-PerformanceCustom-properties-monthlyDividends: + example: 26.37 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-PerformanceCustom-properties-badTickers-items: + example: MAW105 + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-PerformanceCustom-properties-commissions: + example: 3.26 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-PerformanceCustom-properties-forexFees: + example: 5.26 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-PerformanceCustom-properties-fees: + example: 2.72 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-PerformanceCustom-properties-rateOfReturn: + example: 0.082312367452 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-SubPeriodReturnRate-properties-rateOfReturn: + example: 0.012312367452 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-DividendAtDate-properties-symbol: + example: AAPL + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-DividendAtDate-properties-amount: + example: 6.82 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-DividendAtDate-properties-currency: + example: CAD + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-PartnerData-properties-redirect_uri: + example: https://example.com/oauth/snaptrade + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-PartnerData-properties-name: + example: Wealthy Chimpmunk + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-PartnerData-properties-slug: + example: WEALTHYCHIPMUNK + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-PartnerData-properties-logo_url: + example: https://example.com/logo.png + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-PartnerData-properties-pin_required: + example: false + type: boolean + x-do-not-generate: true + konfig-generated-schema-components-schemas-PartnerData-properties-can_access_trades: + example: true + type: boolean + x-do-not-generate: true + konfig-generated-schema-components-schemas-PartnerData-properties-can_access_holdings: + example: true + type: boolean + x-do-not-generate: true + konfig-generated-schema-components-schemas-PartnerData-properties-can_access_account_history: + example: true + type: boolean + x-do-not-generate: true + konfig-generated-schema-components-schemas-PartnerData-properties-can_access_reference_data: + example: true + type: boolean + x-do-not-generate: true + konfig-generated-schema-components-schemas-PartnerData-properties-can_access_portfolio_management: + example: true + type: boolean + x-do-not-generate: true + konfig-generated-schema-components-schemas-PartnerData-properties-can_access_orders: + example: true + type: boolean + x-do-not-generate: true + konfig-generated-schema-components-schemas-Position-properties-units: + example: 40 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-Position-properties-price: + example: 113.15 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-Position-properties-open_pnl: + example: 0.44 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-Position-properties-fractional_units: + example: 1.44 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-Position-properties-average_purchase_price: + example: 108.3353 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-RedirectTokenandPin-properties-token: + example: myDAIBCP/EYqSmMByhMRB65aMa%2BdYhu2xRsGQe0sDd9SgZXMbdRh3eBaTh/bLViVGQoil6p9ytUUVhkqWalejOqCNVkXXTk/iNPTPaFCeh9%2B + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-RedirectTokenandPin-properties-pin: + example: usERdeFiP@1in9 + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-Signature: + example: QJPQgW0Y8mWbG9Whw/fhCYofIgSo/UAo2AIc1bBPMnY= + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-SignedContent: + example: "{\"content\":{\"userId\":\"snaptrade-user-123\",\"userSecret\":\"\ + CHRIS.P.BACON\"},\"path\":\"/api/v1/snapTrade/mockSignature\",\"query\":\"\ + clientId=SNAPTRADETEST×tamp=1635790389\"}" + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-SnapTradeLoginUserRequestBody-properties-broker: + example: ALPACA + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-SnapTradeLoginUserRequestBody-properties-immediateRedirect: + example: true + type: boolean + x-do-not-generate: true + konfig-generated-schema-components-schemas-SnapTradeLoginUserRequestBody-properties-customRedirect: + example: https://snaptrade.com + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-SnapTradeLoginUserRequestBody-properties-reconnect: + example: 8b5f262d-4bb9-365d-888a-202bd3b15fa1 + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-SnapTradeUserID: + example: snaptrade-user-123 + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-SnapTradeUserSecret: + example: h81@cx1lkalablakwjaltkejraj11= + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-Symbol-properties-symbol: + example: VAB.TO + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-Symbol-properties-raw_symbol: + example: VAB + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-Symbol-properties-name: + example: Vanguard Canadian Aggregate Bond Index ETF + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-Symbol-properties-figi_code: + example: BBG000B9XRY4 + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-Timestamp: + example: 1635790389 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-UserList: + example: + - user1 + - user2 + - user3 + items: + example: user1 + type: string + type: array + x-do-not-generate: true + konfig-generated-schema-components-schemas-DeleteUserResponse-properties-status: + example: deleted + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-BrokerageAuthorizationTypeReadOnly-properties-brokerage-properties-name: + example: Questrade + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-BrokerageAuthorizationTypeReadOnly-properties-brokerage-properties-slug: + example: QUESTRADE + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-Brokerage-properties-name: + example: Questrade + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-Brokerage-properties-display_name: + example: Questrade + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-Brokerage-properties-description: + example: Questrade is an online brokerage firm and wealth management firm based + in Canada. It is Canada's largest discount broker. + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-Brokerage-properties-aws_s3_logo_url: + example: https://www.snaptrade.com/questrade.logo + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-Brokerage-properties-aws_s3_square_logo_url: + example: https://www.snaptrade.com/questrade.logo + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-Brokerage-properties-open_url: + example: https://www.brokerage.com + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-Brokerage-properties-slug: + example: QUESTRADE + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-Brokerage-properties-url: + example: https://www.questrade.com/ + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-Brokerage-properties-enabled: + example: true + type: boolean + x-do-not-generate: true + konfig-generated-schema-components-schemas-Brokerage-properties-maintenance_mode: + example: true + type: boolean + x-do-not-generate: true + konfig-generated-schema-components-schemas-Brokerage-properties-allows_fractional_units: + example: true + type: boolean + x-do-not-generate: true + konfig-generated-schema-components-schemas-Brokerage-properties-allows_trading: + example: true + type: boolean + x-do-not-generate: true + konfig-generated-schema-components-schemas-Brokerage-properties-has_reporting: + example: true + type: boolean + x-do-not-generate: true + konfig-generated-schema-components-schemas-Brokerage-properties-is_real_time_connection: + example: true + type: boolean + x-do-not-generate: true + konfig-generated-schema-components-schemas-Brokerage-properties-allows_trading_through_snaptrade_api: + example: true + type: boolean + x-do-not-generate: true + konfig-generated-schema-components-schemas-Brokerage-properties-is_scraping_integration: + example: true + type: boolean + x-do-not-generate: true + konfig-generated-schema-components-schemas-Brokerage-properties-exchanges: + example: + - 2bcd7cc3-e922-4976-bce1-9858296801c3 + - 4bcd8cc3-c122-4974-dc21-1858296801f4 + items: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: string + type: array + x-do-not-generate: true + konfig-generated-schema-components-schemas-BrokerageAuthorization-properties-name: + example: Connection-1 + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-BrokerageAuthorization-properties-type: + example: trade + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-BrokerageAuthorization-properties-disabled: + example: false + type: boolean + x-do-not-generate: true + konfig-generated-schema-components-schemas-BrokerageAuthorization-properties-disabled_date: + example: 2022-01-21T20:11:19.217Z + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-BrokerageAuthorization-properties-meta: + additionalProperties: true + example: + identifier: 123456 + properties: + identifier: + example: 123456 + type: number + type: object + x-do-not-generate: true + konfig-generated-schema-components-schemas-BrokerageAuthorizationRefreshConfirmation-properties-detail: + example: Connection 0b3ebefb-ed47-43df-cd8f-729a4420b5cf scheduled for refresh + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-BrokerageAuthorizationDisabledConfirmation-properties-detail: + example: Connection 0b3ebefb-ed47-43df-cd8f-729a4420b5cf has been disabled + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-SessionEvent-properties-brokerage_status_code: + example: 400 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-BrokerageSymbol-properties-description: + example: VANGUARD CDN AGGREGATE BOND INDEX ETF + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-BrokerageSymbol-properties-allows_fractional_units: + example: true + type: boolean + x-do-not-generate: true + konfig-generated-schema-components-schemas-OptionBrokerageSymbol-properties-description: + example: SPY CALL 7/17 200 + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-PositionSymbol-properties-description: + example: VANGUARD CDN AGGREGATE BOND INDEX ETF + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-PositionSymbol-properties-local_id: + example: "3291231" + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-PositionSymbol-properties-is_quotable: + example: true + type: boolean + x-do-not-generate: true + konfig-generated-schema-components-schemas-PositionSymbol-properties-is_tradable: + example: true + type: boolean + x-do-not-generate: true + konfig-generated-schema-components-schemas-OptionChain-items-properties-expiryDate: + example: 2022-07-08T04:00:00.000Z + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-OptionChain-items-properties-description: + example: APPLE INC + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-OptionChain-items-properties-listingExchange: + example: OPRA + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-OptionChain-items-properties-optionExerciseType: + example: American + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-OptionChain-items-properties-chainPerRoot-items-properties-optionRoot: + example: AAPL + type: string + x-do-not-generate: true + ? konfig-generated-schema-components-schemas-OptionChain-items-properties-chainPerRoot-items-properties-chainPerStrikePrice-items-properties-strikePrice + : example: 70 + type: number + x-do-not-generate: true + ? konfig-generated-schema-components-schemas-OptionChain-items-properties-chainPerRoot-items-properties-chainPerStrikePrice-items-properties-callSymbolId + : example: 42816081 + type: number + x-do-not-generate: true + ? konfig-generated-schema-components-schemas-OptionChain-items-properties-chainPerRoot-items-properties-chainPerStrikePrice-items-properties-putSymbolId + : example: 42816129 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-OptionChain-items-properties-chainPerRoot-items-properties-multiplier: + example: 100 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-Email: + example: ops@snaptrade.com + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-ExchangeRatePairs-properties-exchange_rate: + example: 1.32 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-Id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-ModelAssetClass-properties-name: + example: Bonds + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-ModelPortfolio-properties-name: + example: SnapTrade 5x Aggressive Growth Fund + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-ModelPortfolio-properties-model_type: + example: -1 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-ModelPortfolioAssetClass-properties-percent: + example: 100 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-ModelPortfolioSecurity-properties-percent: + example: 100 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-NetContributions-properties-contributions: + example: 524.74 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-NetContributions-properties-currency: + example: CAD + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-NetDividend-properties-amount: + example: 165.05 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-NetDividend-properties-currency: + example: USD + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-PastValue-properties-value: + example: 52.74 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-PastValue-properties-currency: + example: CAD + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-Percent: + example: 90 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-PortfolioGroupID: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-PortfolioGroup-properties-name: + example: Combined Retirement Portfolio + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-PortfolioGroupInfo-properties-accuracy: + example: 0.962 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-PortfolioGroupPosition-properties-price: + example: 24.81 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-PortfolioGroupPosition-properties-units: + example: 15 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-PortfolioGroupSettings-properties-buyOnly: + example: true + type: boolean + x-do-not-generate: true + konfig-generated-schema-components-schemas-PortfolioGroupSettings-properties-cash_optimizer: + example: true + type: boolean + x-do-not-generate: true + konfig-generated-schema-components-schemas-PortfolioGroupSettings-properties-notifyFrequency: + example: 7 00:00:00 + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-ReportingDate: + example: 2022-01-24 + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-ReportingFrequency: + example: monthly + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-Status-properties-version: + example: 151 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-Status-properties-timestamp: + example: 2022-11-04T01:47:00.377Z + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-Status-properties-online: + example: true + type: boolean + x-do-not-generate: true + konfig-generated-schema-components-schemas-SymbolQuery-properties-substring: + example: apple + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-SyncStatusDate: + example: 2022-01-24 + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-HoldingsSyncStatusDate: + example: 2024-06-28 18:42:46.561408+00:00 + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-TargetAsset-properties-is_supported: + example: true + type: boolean + x-do-not-generate: true + konfig-generated-schema-components-schemas-TargetAsset-properties-is_excluded: + example: true + type: boolean + x-do-not-generate: true + konfig-generated-schema-components-schemas-Trade-properties-action: + example: BUY + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-Trade-properties-units: + example: 6 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-Trade-properties-price: + example: 24.81 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-Trade-properties-sequence: + example: 1 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-TradeExecutionStatus-properties-state: + example: Executed + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-TradeExecutionStatus-properties-filled_units: + example: 3 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-TradeExecutionStatus-properties-action: + example: SELL + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-TradeExecutionStatus-properties-price: + example: 23.44 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-TradeExecutionStatus-properties-commissions: + example: 23.44 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-TradeExecutionStatus-properties-meta: + additionalProperties: true + example: + canceledUnits: 2 + properties: + canceledUnits: + example: 2 + type: number + type: object + x-do-not-generate: true + konfig-generated-schema-components-schemas-TradeImpact-properties-remaining_cash: + example: 1.01 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-TradeImpact-properties-estimated_commissions: + example: 10.05 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-TradeImpact-properties-forex_fees: + example: 2.01 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-ManualTrade-properties-account: + example: 2bcd7cc3-e922-4976-bce1-9855556801c3 + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-ManualTradeSymbol-properties-local_id: + example: "1048101" + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-ManualTradeSymbol-properties-description: + example: Metaverse Global ETF + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-ManualTradeSymbol-properties-symbol: + example: MVGP.U.TO + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-SymbolsQuotes-items-properties-bid_price: + example: 8.43 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-SymbolsQuotes-items-properties-ask_price: + example: 8.43 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-SymbolsQuotes-items-properties-last_trade_price: + example: 8.74 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-SymbolsQuotes-items-properties-bid_size: + example: 260 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-SymbolsQuotes-items-properties-ask_size: + example: 344 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-ValidatedTradeBody-properties-wait_to_confirm: + example: true + type: boolean + x-do-not-generate: true + konfig-generated-schema-components-schemas-Cash: + example: 1.11 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-SnapTradeAPIDisclaimerAcceptStatus-properties-timestamp: + example: 2022-01-21T20:11:19.217Z + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-Price: + example: 31.33 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-StopPrice: + example: 31.33 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-UniversalActivity-properties-id: + example: 2f7dc9b3-5c33-4668-3440-2b31e056ebe6 + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-UniversalActivity-properties-amount: + example: 263.82 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-UniversalActivity-properties-description: + example: WALT DISNEY UNIT DIST ON 21 SHS REC 12/31/21 PAY 01/06/22 + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-UniversalActivity-properties-fee: + example: 0 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-UniversalActivity-properties-fx_rate: + example: 1.032 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-UniversalActivity-properties-institution: + example: SnapTrade Investr + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-UniversalActivity-properties-option_type: + example: BUY_TO_OPEN + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-UniversalActivity-properties-price: + example: 0.4 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-UniversalActivity-properties-settlement_date: + example: 2022-01-06T05:00:00.000Z + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-UniversalActivity-properties-external_reference_id: + example: 2f7dc9b3-5c33-4668-3440-2b31e056ebe6 + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-UniversalActivity-properties-trade_date: + example: 2022-01-06T05:00:00.000Z + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-UniversalActivity-properties-units: + example: 5 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-FigiInstrument-properties-figi_code: + example: BBG000B9Y5X2 + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-FigiInstrument-properties-figi_share_class: + example: BBG001S5N8V8 + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-UniversalSymbol-properties-symbol: + example: VAB.TO + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-UniversalSymbol-properties-raw_symbol: + example: VAB + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-UniversalSymbol-properties-description: + example: VANGUARD CDN AGGREGATE BOND INDEX ETF + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-UniversalSymbol-properties-figi_code: + example: BBG000B9XRY4 + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-UnderlyingSymbol-properties-symbol: + example: SPY + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-UnderlyingSymbol-properties-description: + example: SPDR S&P 500 ETF Trust + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-UnderlyingSymbol-properties-figi_code: + example: BBG000B9XRY4 + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-OptionsSymbol-properties-ticker: + example: SPY 220819P00200000 + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-OptionsSymbol-properties-option_type: + example: CALL + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-OptionsSymbol-properties-strike_price: + example: 200 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-OptionsSymbol-properties-expiration_date: + example: 2017-07-17T15:13:07.177712+00:00 + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-OptionsSymbol-properties-is_mini_option: + example: false + type: boolean + x-do-not-generate: true + konfig-generated-schema-components-schemas-OptionsSymbol-properties-local_id: + example: "40817960" + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-OptionLeg-properties-option_symbol_id: + example: SPY220819P00200000 + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-OptionLeg-properties-quantity: + example: 1 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-SecurityType-properties-code: + example: cs + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-SecurityType-properties-description: + example: Common Stock + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-SecurityType-properties-is_supported: + example: true + type: boolean + x-do-not-generate: true + konfig-generated-schema-components-schemas-SnapTradePartnerAPICredential-properties-redirect_uri: + example: https://www.example.com/oauth + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-UserSettings-properties-name: + example: James Bond + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-UserSettings-properties-receive_cash_notification: + example: true + type: boolean + x-do-not-generate: true + konfig-generated-schema-components-schemas-UserSettings-properties-receive_drift_notification: + example: true + type: boolean + x-do-not-generate: true + konfig-generated-schema-components-schemas-UserSettings-properties-user_trial_activated: + example: true + type: boolean + x-do-not-generate: true + konfig-generated-schema-components-schemas-UserSettings-properties-activated_trial_date: + example: 2017-07-17T15:13:07.177712+00:00 + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-UserSettings-properties-demo: + example: false + type: boolean + x-do-not-generate: true + konfig-generated-schema-components-schemas-UserSettings-properties-api_enabled: + example: false + type: boolean + x-do-not-generate: true + konfig-generated-schema-components-schemas-UserSettings-properties-drift_threshold: + example: 95 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-Time: + example: 2022-01-21T20:11:19.217Z + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-BrokerageType-properties-name: + example: Traditional Brokerage + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-WebhookBase-properties-webookId: + example: 06fe1fd7-fc50-43a7-b564-8a2c5f3bab44 + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-WebhookBase-properties-clientId: + example: WEALTHYCHIPMUNK + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-WebhookBase-properties-eventTimestamp: + example: 2022-01-21T20:11:19.217Z + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-WebhookBase-properties-userId: + example: external_user@test.com + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-UserErrorLog-properties-requestedAt: + example: 2022-01-21T20:11:19.217Z + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-UserErrorLog-properties-statusCode: + example: 200 + type: number + x-do-not-generate: true + konfig-generated-schema-components-schemas-UserErrorLog-properties-httpMethod: + example: POST + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-UserErrorLog-properties-endpoint: + example: api/v1/snapTrade + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-rsaPublicKey: + example: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQC7vbqajDw4o6gJy8UtmIbkcpnkO3Kwc4qsEnSZp/TR+fQi62F79RHWmwKOtFmwteURgLbj7D/WGuNLGOfa/2vse3G2eHnHl5CB8ruRX9fBl/KgwCVr2JaEuUm66bBQeP5XeBotdR4cvX38uPYivCDdPjJ1QWPdspTBKcxeFbccDw== + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-encryptedResponse-properties-encryptedSharedKey: + example: 5UEaY9QGzcNTr8y2jGDUI79jY1OdfK9x + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-encryptedResponse-properties-encryptedMessageData-properties-encryptedMessage: + example: 9Xy05vqZOfp0OpW5fLAaDw== + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-encryptedResponse-properties-encryptedMessageData-properties-tag: + example: mWZPkpQh5ktbcz6N7cTRmQ== + type: string + x-do-not-generate: true + konfig-generated-schema-components-schemas-encryptedResponse-properties-encryptedMessageData-properties-nonce: + example: None + type: string + x-do-not-generate: true + konfig-generated-schema-single-parameter-schema-get--: + additionalProperties: true + properties: {} + type: object + x-do-not-generate: true + x-konfig-is-parameter: [] + konfig-generated-schema-single-parameter-schema-post--snapTrade-registerUser: + additionalProperties: true + properties: + userId: + $ref: '#/components/schemas/SnapTradeUserID' + type: object + x-do-not-generate: true + x-konfig-is-parameter: [] + konfig-generated-schema-single-parameter-schema-post--snapTrade-login: + additionalProperties: true + properties: + userId: + $ref: '#/components/schemas/UserID' + userSecret: + $ref: '#/components/schemas/UserSecret' + broker: + description: "Slug of the brokerage to connect the user to. See [this document](https://snaptrade.notion.site/SnapTrade-Brokerage-Integrations-f83946a714a84c3caf599f6a945f0ead)\ + \ for a list of supported brokerages and their slugs." + example: ALPACA + type: string + x-konfig-original-example: ALPACA + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SnapTradeLoginUserRequestBody-properties-broker + immediateRedirect: + description: "When set to True, user will be redirected back to the partner's\ + \ site instead of the connection portal" + example: true + type: boolean + x-konfig-original-example: true + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SnapTradeLoginUserRequestBody-properties-immediateRedirect + customRedirect: + description: URL to redirect the user to after the user connects their brokerage + account + example: https://snaptrade.com + type: string + x-konfig-original-example: https://snaptrade.com + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SnapTradeLoginUserRequestBody-properties-customRedirect + reconnect: + description: The UUID of the brokerage connection to be reconnected. This + parameter should be left empty unless you are reconnecting a disabled + connection. See ‘Reconnecting Accounts’ for more information. + example: 8b5f262d-4bb9-365d-888a-202bd3b15fa1 + type: string + x-konfig-original-example: 8b5f262d-4bb9-365d-888a-202bd3b15fa1 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SnapTradeLoginUserRequestBody-properties-reconnect + connectionType: + description: Sets whether the connection should be read or trade + enum: + - read + - trade + type: string + connectionPortalVersion: + description: "Sets the version of the connection portal to render, with\ + \ a default to 'v3'" + enum: + - v2 + - v3 + type: string + required: + - userId + - userSecret + type: object + x-do-not-generate: true + x-konfig-is-parameter: + - userId + - userSecret + konfig-generated-schema-single-parameter-schema-get--snapTrade-listUsers: + additionalProperties: true + properties: {} + type: object + x-do-not-generate: true + x-konfig-is-parameter: [] + konfig-generated-schema-single-parameter-schema-delete--snapTrade-deleteUser: + additionalProperties: true + properties: + userId: + $ref: '#/components/schemas/UserID' + required: + - userId + type: object + x-do-not-generate: true + x-konfig-is-parameter: + - userId + konfig-generated-schema-single-parameter-schema-post--snapTrade-resetUserSecret: + additionalProperties: true + properties: + userId: + $ref: '#/components/schemas/SnapTradeUserID' + userSecret: + $ref: '#/components/schemas/SnapTradeUserSecret' + type: object + x-do-not-generate: true + x-konfig-is-parameter: [] + konfig-generated-schema-single-parameter-schema-get--authorizations: + additionalProperties: true + properties: + userId: + $ref: '#/components/schemas/UserID' + userSecret: + $ref: '#/components/schemas/UserSecret' + required: + - userId + - userSecret + type: object + x-do-not-generate: true + x-konfig-is-parameter: + - userId + - userSecret + konfig-generated-schema-single-parameter-schema-delete--authorizations-authorizationId: + additionalProperties: true + properties: + authorizationId: + $ref: '#/components/schemas/Id' + userId: + $ref: '#/components/schemas/UserID' + userSecret: + $ref: '#/components/schemas/UserSecret' + required: + - authorizationId + - userId + - userSecret + type: object + x-do-not-generate: true + x-konfig-is-parameter: + - authorizationId + - userId + - userSecret + konfig-generated-schema-single-parameter-schema-get--authorizations-authorizationId: + additionalProperties: true + properties: + authorizationId: + $ref: '#/components/schemas/Id' + userId: + $ref: '#/components/schemas/UserID' + userSecret: + $ref: '#/components/schemas/UserSecret' + required: + - authorizationId + - userId + - userSecret + type: object + x-do-not-generate: true + x-konfig-is-parameter: + - authorizationId + - userId + - userSecret + konfig-generated-schema-single-parameter-schema-post--authorizations-authorizationId-refresh: + additionalProperties: true + properties: + authorizationId: + $ref: '#/components/schemas/Id' + userId: + $ref: '#/components/schemas/UserID' + userSecret: + $ref: '#/components/schemas/UserSecret' + required: + - authorizationId + - userId + - userSecret + type: object + x-do-not-generate: true + x-konfig-is-parameter: + - authorizationId + - userId + - userSecret + konfig-generated-schema-single-parameter-schema-post--authorizations-authorizationId-disable: + additionalProperties: true + properties: + authorizationId: + $ref: '#/components/schemas/Id' + userId: + $ref: '#/components/schemas/UserID' + userSecret: + $ref: '#/components/schemas/UserSecret' + required: + - authorizationId + - userId + - userSecret + type: object + x-do-not-generate: true + x-konfig-is-parameter: + - authorizationId + - userId + - userSecret + konfig-generated-schema-single-parameter-schema-get--sessionEvents: + additionalProperties: true + properties: + PartnerClientId: + $ref: '#/components/schemas/ClientID' + userId: + $ref: '#/components/schemas/AccountIDs' + sessionId: + $ref: '#/components/schemas/AccountIDs' + required: + - PartnerClientId + type: object + x-do-not-generate: true + x-konfig-is-parameter: + - PartnerClientId + - userId + - sessionId + konfig-generated-schema-single-parameter-schema-get--accounts: + additionalProperties: true + properties: + userId: + $ref: '#/components/schemas/UserID' + userSecret: + $ref: '#/components/schemas/UserSecret' + required: + - userId + - userSecret + type: object + x-do-not-generate: true + x-konfig-is-parameter: + - userId + - userSecret + konfig-generated-schema-single-parameter-schema-get--holdings: + additionalProperties: true + properties: + userId: + $ref: '#/components/schemas/UserID' + userSecret: + $ref: '#/components/schemas/UserSecret' + brokerage_authorizations: + example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + format: uuid + type: string + x-konfig-original-example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + x-konfig-generated-schema: konfig-generated-schema-paths--holdings-get-parameters-2-schema + required: + - userId + - userSecret + type: object + x-do-not-generate: true + x-konfig-is-parameter: + - userId + - userSecret + - brokerage_authorizations + konfig-generated-schema-single-parameter-schema-get--accounts-accountId-holdings: + additionalProperties: true + properties: + accountId: + $ref: '#/components/schemas/AccountID' + userId: + $ref: '#/components/schemas/UserID' + userSecret: + $ref: '#/components/schemas/UserSecret' + required: + - accountId + - userId + - userSecret + type: object + x-do-not-generate: true + x-konfig-is-parameter: + - accountId + - userId + - userSecret + konfig-generated-schema-single-parameter-schema-get--accounts-accountId: + additionalProperties: true + properties: + userId: + $ref: '#/components/schemas/UserID' + userSecret: + $ref: '#/components/schemas/UserSecret' + accountId: + example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + format: uuid + type: string + x-konfig-original-example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + x-konfig-generated-schema: konfig-generated-schema-paths--accounts-accountId-get-parameters-2-schema + required: + - accountId + - userId + - userSecret + type: object + x-do-not-generate: true + x-konfig-is-parameter: + - userId + - userSecret + - accountId + konfig-generated-schema-single-parameter-schema-put--accounts-accountId: + additionalProperties: true + properties: + userId: + $ref: '#/components/schemas/UserID' + userSecret: + $ref: '#/components/schemas/UserSecret' + accountId: + format: uuid + type: string + required: + - accountId + - userId + - userSecret + type: object + x-do-not-generate: true + x-konfig-is-parameter: + - userId + - userSecret + - accountId + konfig-generated-schema-single-parameter-schema-get--accounts-accountId-balances: + additionalProperties: true + properties: + userId: + $ref: '#/components/schemas/UserID' + userSecret: + $ref: '#/components/schemas/UserSecret' + accountId: + example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + format: uuid + type: string + x-konfig-original-example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + x-konfig-generated-schema: konfig-generated-schema-paths--accounts-accountId-balances-get-parameters-2-schema + required: + - accountId + - userId + - userSecret + type: object + x-do-not-generate: true + x-konfig-is-parameter: + - userId + - userSecret + - accountId + konfig-generated-schema-single-parameter-schema-get--accounts-accountId-positions: + additionalProperties: true + properties: + userId: + $ref: '#/components/schemas/UserID' + userSecret: + $ref: '#/components/schemas/UserSecret' + accountId: + example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + format: uuid + type: string + x-konfig-original-example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + x-konfig-generated-schema: konfig-generated-schema-paths--accounts-accountId-positions-get-parameters-2-schema + required: + - accountId + - userId + - userSecret + type: object + x-do-not-generate: true + x-konfig-is-parameter: + - userId + - userSecret + - accountId + konfig-generated-schema-single-parameter-schema-get--accounts-accountId-orders: + additionalProperties: true + properties: + userId: + $ref: '#/components/schemas/UserID' + userSecret: + $ref: '#/components/schemas/UserSecret' + state: + enum: + - all + - open + - executed + type: string + days: + example: 30 + format: int32 + minimum: 1 + type: integer + x-konfig-original-example: 30 + x-konfig-generated-schema: konfig-generated-schema-paths--accounts-accountId-orders-get-parameters-3-schema + accountId: + example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + format: uuid + type: string + x-konfig-original-example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + x-konfig-generated-schema: konfig-generated-schema-paths--accounts-accountId-orders-get-parameters-4-schema + required: + - accountId + - userId + - userSecret + type: object + x-do-not-generate: true + x-konfig-is-parameter: + - userId + - userSecret + - state + - days + - accountId + konfig-generated-schema-single-parameter-schema-get--accounts-accountId-quotes: + additionalProperties: true + properties: + userId: + $ref: '#/components/schemas/UserID' + userSecret: + $ref: '#/components/schemas/UserSecret' + symbols: + type: string + use_ticker: + type: boolean + accountId: + example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + format: uuid + type: string + x-konfig-original-example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + x-konfig-generated-schema: konfig-generated-schema-paths--accounts-accountId-quotes-get-parameters-4-schema + required: + - accountId + - symbols + - userId + - userSecret + type: object + x-do-not-generate: true + x-konfig-is-parameter: + - userId + - userSecret + - symbols + - use_ticker + - accountId + konfig-generated-schema-single-parameter-schema-post--trade-impact: + additionalProperties: true + properties: + userId: + $ref: '#/components/schemas/UserID' + userSecret: + $ref: '#/components/schemas/UserSecret' + account_id: + $ref: '#/components/schemas/Id' + action: + $ref: '#/components/schemas/ActionStrict' + order_type: + $ref: '#/components/schemas/OrderTypeStrict' + price: + $ref: '#/components/schemas/Price' + stop: + $ref: '#/components/schemas/StopPrice' + time_in_force: + $ref: '#/components/schemas/TimeInForceStrict' + units: + $ref: '#/components/schemas/UnitsNullable' + universal_symbol_id: + $ref: '#/components/schemas/Id' + notional_value: + $ref: '#/components/schemas/NotionalValueNullable' + required: + - userId + - userSecret + type: object + x-do-not-generate: true + x-konfig-is-parameter: + - userId + - userSecret + konfig-generated-schema-single-parameter-schema-post--trade-tradeId: + additionalProperties: true + properties: + tradeId: + format: uuid + type: string + userId: + $ref: '#/components/schemas/UserID' + userSecret: + $ref: '#/components/schemas/UserSecret' + wait_to_confirm: + description: "Optional, defaults to true. Determines if a wait is performed\ + \ to check on order status. If false, latency will be reduced but orders\ + \ returned will be more likely to be of status PENDING as we will not\ + \ wait to check on the status before responding to the request" + example: true + nullable: true + type: boolean + x-konfig-original-example: true + x-konfig-generated-schema: konfig-generated-schema-components-schemas-ValidatedTradeBody-properties-wait_to_confirm + required: + - tradeId + - userId + - userSecret + type: object + x-do-not-generate: true + x-konfig-is-parameter: + - tradeId + - userId + - userSecret + konfig-generated-schema-single-parameter-schema-post--trade-place: + additionalProperties: true + properties: + userId: + $ref: '#/components/schemas/UserID' + userSecret: + $ref: '#/components/schemas/UserSecret' + account_id: + $ref: '#/components/schemas/Id' + action: + $ref: '#/components/schemas/ActionStrict' + order_type: + $ref: '#/components/schemas/OrderTypeStrict' + price: + $ref: '#/components/schemas/Price' + stop: + $ref: '#/components/schemas/StopPrice' + time_in_force: + $ref: '#/components/schemas/TimeInForceStrict' + units: + $ref: '#/components/schemas/UnitsNullable' + universal_symbol_id: + $ref: '#/components/schemas/Id' + notional_value: + $ref: '#/components/schemas/NotionalValueNullable' + required: + - userId + - userSecret + type: object + x-do-not-generate: true + x-konfig-is-parameter: + - userId + - userSecret + konfig-generated-schema-single-parameter-schema-post--accounts-accountId-orders-cancel: + additionalProperties: true + properties: + userId: + $ref: '#/components/schemas/UserID' + userSecret: + $ref: '#/components/schemas/UserSecret' + accountId: + example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + format: uuid + type: string + x-konfig-original-example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + x-konfig-generated-schema: konfig-generated-schema-paths--accounts-accountId-orders-cancel-post-parameters-2-schema + brokerage_order_id: + $ref: '#/components/schemas/Id' + required: + - accountId + - userId + - userSecret + type: object + x-do-not-generate: true + x-konfig-is-parameter: + - userId + - userSecret + - accountId + konfig-generated-schema-single-parameter-schema-get--snapTrade-partners: + additionalProperties: true + properties: {} + type: object + x-do-not-generate: true + x-konfig-is-parameter: [] + konfig-generated-schema-single-parameter-schema-post--accounts-accountId-symbols: + additionalProperties: true + properties: + userId: + $ref: '#/components/schemas/UserID' + userSecret: + $ref: '#/components/schemas/UserSecret' + accountId: + example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + format: uuid + type: string + x-konfig-original-example: 917c8734-8470-4a3e-a18f-57c3f2ee6631 + x-konfig-generated-schema: konfig-generated-schema-paths--accounts-accountId-symbols-post-parameters-2-schema + substring: + example: apple + type: string + x-konfig-original-example: apple + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SymbolQuery-properties-substring + required: + - accountId + - userId + - userSecret + type: object + x-do-not-generate: true + x-konfig-is-parameter: + - userId + - userSecret + - accountId + konfig-generated-schema-single-parameter-schema-get--accounts-accountId-options: + additionalProperties: true + properties: + userId: + $ref: '#/components/schemas/UserID' + userSecret: + $ref: '#/components/schemas/UserSecret' + accountId: + format: uuid + type: string + required: + - accountId + - userId + - userSecret + type: object + x-do-not-generate: true + x-konfig-is-parameter: + - userId + - userSecret + - accountId + konfig-generated-schema-single-parameter-schema-get--accounts-accountId-optionsChain: + additionalProperties: true + properties: + userId: + $ref: '#/components/schemas/UserID' + userSecret: + $ref: '#/components/schemas/UserSecret' + accountId: + format: uuid + type: string + symbol: + format: uuid + type: string + required: + - accountId + - symbol + - userId + - userSecret + type: object + x-do-not-generate: true + x-konfig-is-parameter: + - userId + - userSecret + - accountId + - symbol + konfig-generated-schema-single-parameter-schema-post--accounts-accountId-optionStrategy: + additionalProperties: true + properties: + userId: + $ref: '#/components/schemas/UserID' + userSecret: + $ref: '#/components/schemas/UserSecret' + accountId: + format: uuid + type: string + underlying_symbol_id: + $ref: '#/components/schemas/Id' + legs: + items: + $ref: '#/components/schemas/OptionLeg' + type: array + strategy_type: + enum: + - CUSTOM + type: string + required: + - accountId + - legs + - strategy_type + - underlying_symbol_id + - userId + - userSecret + type: object + x-do-not-generate: true + x-konfig-is-parameter: + - userId + - userSecret + - accountId + konfig-generated-schema-single-parameter-schema-get--accounts-accountId-optionStrategy-optionStrategyId: + additionalProperties: true + properties: + userId: + $ref: '#/components/schemas/UserID' + userSecret: + $ref: '#/components/schemas/UserSecret' + accountId: + format: uuid + type: string + optionStrategyId: + $ref: '#/components/schemas/Id' + required: + - accountId + - optionStrategyId + - userId + - userSecret + type: object + x-do-not-generate: true + x-konfig-is-parameter: + - userId + - userSecret + - accountId + - optionStrategyId + konfig-generated-schema-single-parameter-schema-post--accounts-accountId-optionStrategy-optionStrategyId-execute: + additionalProperties: true + properties: + userId: + $ref: '#/components/schemas/UserID' + userSecret: + $ref: '#/components/schemas/UserSecret' + accountId: + $ref: '#/components/schemas/Id' + optionStrategyId: + $ref: '#/components/schemas/Id' + order_type: + $ref: '#/components/schemas/OrderTypeStrict' + time_in_force: + $ref: '#/components/schemas/TimeInForceStrict' + price: + $ref: '#/components/schemas/Price' + required: + - accountId + - optionStrategyId + - order_type + - time_in_force + - userId + - userSecret + type: object + x-do-not-generate: true + x-konfig-is-parameter: + - userId + - userSecret + - accountId + - optionStrategyId + konfig-generated-schema-single-parameter-schema-get--brokerages: + additionalProperties: true + properties: {} + type: object + x-do-not-generate: true + x-konfig-is-parameter: [] + konfig-generated-schema-single-parameter-schema-get--brokerageAuthorizationTypes: + additionalProperties: true + properties: + brokerage: + example: "QUESTRADE,ALPACA" + type: string + x-konfig-original-example: "QUESTRADE,ALPACA" + x-konfig-generated-schema: konfig-generated-schema-paths--brokerageAuthorizationTypes-get-parameters-0-schema + type: object + x-do-not-generate: true + x-konfig-is-parameter: + - brokerage + konfig-generated-schema-single-parameter-schema-get--currencies: + additionalProperties: true + properties: {} + type: object + x-do-not-generate: true + x-konfig-is-parameter: [] + konfig-generated-schema-single-parameter-schema-get--currencies-rates: + additionalProperties: true + properties: {} + type: object + x-do-not-generate: true + x-konfig-is-parameter: [] + konfig-generated-schema-single-parameter-schema-get--currencies-rates-currencyPair: + additionalProperties: true + properties: + currencyPair: + type: string + required: + - currencyPair + type: object + x-do-not-generate: true + x-konfig-is-parameter: + - currencyPair + konfig-generated-schema-single-parameter-schema-get--exchanges: + additionalProperties: true + properties: {} + type: object + x-do-not-generate: true + x-konfig-is-parameter: [] + konfig-generated-schema-single-parameter-schema-get--securityTypes: + additionalProperties: true + properties: {} + type: object + x-do-not-generate: true + x-konfig-is-parameter: [] + konfig-generated-schema-single-parameter-schema-post--symbols: + additionalProperties: true + properties: + substring: + example: apple + type: string + x-konfig-original-example: apple + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SymbolQuery-properties-substring + type: object + x-do-not-generate: true + x-konfig-is-parameter: [] + konfig-generated-schema-single-parameter-schema-get--symbols-query: + additionalProperties: true + properties: + query: + type: string + required: + - query + type: object + x-do-not-generate: true + x-konfig-is-parameter: + - query + konfig-generated-schema-single-parameter-schema-get--activities: + additionalProperties: true + properties: + startDate: + $ref: '#/components/schemas/ReportingDate' + endDate: + $ref: '#/components/schemas/ReportingDate' + accounts: + $ref: '#/components/schemas/AccountIDs' + brokerageAuthorizations: + $ref: '#/components/schemas/BrokerageAuthIDs' + type: + example: DIVIDEND + type: string + x-konfig-original-example: DIVIDEND + x-konfig-generated-schema: konfig-generated-schema-paths--activities-get-parameters-4-schema + userId: + $ref: '#/components/schemas/UserID' + userSecret: + $ref: '#/components/schemas/UserSecret' + required: + - userId + - userSecret + type: object + x-do-not-generate: true + x-konfig-is-parameter: + - startDate + - endDate + - accounts + - brokerageAuthorizations + - type + - userId + - userSecret + konfig-generated-schema-single-parameter-schema-get--performance-custom: + additionalProperties: true + properties: + startDate: + $ref: '#/components/schemas/ReportingDate' + endDate: + $ref: '#/components/schemas/ReportingDate' + accounts: + $ref: '#/components/schemas/AccountIDs' + detailed: + example: true + type: boolean + x-konfig-original-example: true + x-konfig-generated-schema: konfig-generated-schema-paths--performance-custom-get-parameters-3-schema + frequency: + $ref: '#/components/schemas/ReportingFrequency' + userId: + $ref: '#/components/schemas/UserID' + userSecret: + $ref: '#/components/schemas/UserSecret' + required: + - endDate + - startDate + - userId + - userSecret + type: object + x-do-not-generate: true + x-konfig-is-parameter: + - startDate + - endDate + - accounts + - detailed + - frequency + - userId + - userSecret + konfig-generated-schema-single-parameter-schema-post--connectionAdded: + additionalProperties: true + properties: + webookId: + example: 06fe1fd7-fc50-43a7-b564-8a2c5f3bab44 + type: string + x-konfig-original-example: 06fe1fd7-fc50-43a7-b564-8a2c5f3bab44 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-WebhookBase-properties-webookId + clientId: + example: WEALTHYCHIPMUNK + type: string + x-konfig-original-example: WEALTHYCHIPMUNK + x-konfig-generated-schema: konfig-generated-schema-components-schemas-WebhookBase-properties-clientId + eventTimestamp: + example: 2022-01-21T20:11:19.217Z + type: string + x-konfig-original-example: 2022-01-21T20:11:19.217Z + x-konfig-generated-schema: konfig-generated-schema-components-schemas-WebhookBase-properties-eventTimestamp + userId: + example: external_user@test.com + type: string + x-konfig-original-example: external_user@test.com + x-konfig-generated-schema: konfig-generated-schema-components-schemas-WebhookBase-properties-userId + type: object + x-do-not-generate: true + x-konfig-is-parameter: [] + konfig-generated-schema-single-parameter-schema-post--connectionDeleted: + additionalProperties: true + properties: + webookId: + example: 06fe1fd7-fc50-43a7-b564-8a2c5f3bab44 + type: string + x-konfig-original-example: 06fe1fd7-fc50-43a7-b564-8a2c5f3bab44 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-WebhookBase-properties-webookId + clientId: + example: WEALTHYCHIPMUNK + type: string + x-konfig-original-example: WEALTHYCHIPMUNK + x-konfig-generated-schema: konfig-generated-schema-components-schemas-WebhookBase-properties-clientId + eventTimestamp: + example: 2022-01-21T20:11:19.217Z + type: string + x-konfig-original-example: 2022-01-21T20:11:19.217Z + x-konfig-generated-schema: konfig-generated-schema-components-schemas-WebhookBase-properties-eventTimestamp + userId: + example: external_user@test.com + type: string + x-konfig-original-example: external_user@test.com + x-konfig-generated-schema: konfig-generated-schema-components-schemas-WebhookBase-properties-userId + type: object + x-do-not-generate: true + x-konfig-is-parameter: [] + konfig-generated-schema-single-parameter-schema-post--userRegistered: + additionalProperties: true + properties: + webookId: + example: 06fe1fd7-fc50-43a7-b564-8a2c5f3bab44 + type: string + x-konfig-original-example: 06fe1fd7-fc50-43a7-b564-8a2c5f3bab44 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-WebhookBase-properties-webookId + clientId: + example: WEALTHYCHIPMUNK + type: string + x-konfig-original-example: WEALTHYCHIPMUNK + x-konfig-generated-schema: konfig-generated-schema-components-schemas-WebhookBase-properties-clientId + eventTimestamp: + example: 2022-01-21T20:11:19.217Z + type: string + x-konfig-original-example: 2022-01-21T20:11:19.217Z + x-konfig-generated-schema: konfig-generated-schema-components-schemas-WebhookBase-properties-eventTimestamp + userId: + example: external_user@test.com + type: string + x-konfig-original-example: external_user@test.com + x-konfig-generated-schema: konfig-generated-schema-components-schemas-WebhookBase-properties-userId + type: object + x-do-not-generate: true + x-konfig-is-parameter: [] + konfig-generated-schema-single-parameter-schema-post--userDeleted: + additionalProperties: true + properties: + webookId: + example: 06fe1fd7-fc50-43a7-b564-8a2c5f3bab44 + type: string + x-konfig-original-example: 06fe1fd7-fc50-43a7-b564-8a2c5f3bab44 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-WebhookBase-properties-webookId + clientId: + example: WEALTHYCHIPMUNK + type: string + x-konfig-original-example: WEALTHYCHIPMUNK + x-konfig-generated-schema: konfig-generated-schema-components-schemas-WebhookBase-properties-clientId + eventTimestamp: + example: 2022-01-21T20:11:19.217Z + type: string + x-konfig-original-example: 2022-01-21T20:11:19.217Z + x-konfig-generated-schema: konfig-generated-schema-components-schemas-WebhookBase-properties-eventTimestamp + userId: + example: external_user@test.com + type: string + x-konfig-original-example: external_user@test.com + x-konfig-generated-schema: konfig-generated-schema-components-schemas-WebhookBase-properties-userId + type: object + x-do-not-generate: true + x-konfig-is-parameter: [] + konfig-generated-schema-single-parameter-schema-post--accountAdded: + additionalProperties: true + properties: + webookId: + example: 06fe1fd7-fc50-43a7-b564-8a2c5f3bab44 + type: string + x-konfig-original-example: 06fe1fd7-fc50-43a7-b564-8a2c5f3bab44 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-WebhookBase-properties-webookId + clientId: + example: WEALTHYCHIPMUNK + type: string + x-konfig-original-example: WEALTHYCHIPMUNK + x-konfig-generated-schema: konfig-generated-schema-components-schemas-WebhookBase-properties-clientId + eventTimestamp: + example: 2022-01-21T20:11:19.217Z + type: string + x-konfig-original-example: 2022-01-21T20:11:19.217Z + x-konfig-generated-schema: konfig-generated-schema-components-schemas-WebhookBase-properties-eventTimestamp + userId: + example: external_user@test.com + type: string + x-konfig-original-example: external_user@test.com + x-konfig-generated-schema: konfig-generated-schema-components-schemas-WebhookBase-properties-userId + type: object + x-do-not-generate: true + x-konfig-is-parameter: [] + konfig-generated-schema-single-parameter-schema-post--accountDeleted: + additionalProperties: true + properties: + webookId: + example: 06fe1fd7-fc50-43a7-b564-8a2c5f3bab44 + type: string + x-konfig-original-example: 06fe1fd7-fc50-43a7-b564-8a2c5f3bab44 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-WebhookBase-properties-webookId + clientId: + example: WEALTHYCHIPMUNK + type: string + x-konfig-original-example: WEALTHYCHIPMUNK + x-konfig-generated-schema: konfig-generated-schema-components-schemas-WebhookBase-properties-clientId + eventTimestamp: + example: 2022-01-21T20:11:19.217Z + type: string + x-konfig-original-example: 2022-01-21T20:11:19.217Z + x-konfig-generated-schema: konfig-generated-schema-components-schemas-WebhookBase-properties-eventTimestamp + userId: + example: external_user@test.com + type: string + x-konfig-original-example: external_user@test.com + x-konfig-generated-schema: konfig-generated-schema-components-schemas-WebhookBase-properties-userId + type: object + x-do-not-generate: true + x-konfig-is-parameter: [] + konfig-generated-schema-single-parameter-schema-post--transactionsUpdated: + additionalProperties: true + properties: + webookId: + example: 06fe1fd7-fc50-43a7-b564-8a2c5f3bab44 + type: string + x-konfig-original-example: 06fe1fd7-fc50-43a7-b564-8a2c5f3bab44 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-WebhookBase-properties-webookId + clientId: + example: WEALTHYCHIPMUNK + type: string + x-konfig-original-example: WEALTHYCHIPMUNK + x-konfig-generated-schema: konfig-generated-schema-components-schemas-WebhookBase-properties-clientId + eventTimestamp: + example: 2022-01-21T20:11:19.217Z + type: string + x-konfig-original-example: 2022-01-21T20:11:19.217Z + x-konfig-generated-schema: konfig-generated-schema-components-schemas-WebhookBase-properties-eventTimestamp + userId: + example: external_user@test.com + type: string + x-konfig-original-example: external_user@test.com + x-konfig-generated-schema: konfig-generated-schema-components-schemas-WebhookBase-properties-userId + type: object + x-do-not-generate: true + x-konfig-is-parameter: [] + AmountNullable: + description: "Total value of the account, as reported by the brokerage" + example: + amount: 15363.23 + currency: USD + nullable: true + properties: + amount: + description: Total value denominated in the currency of the `currency` field. + example: 15363.23 + type: number + x-konfig-original-example: 15363.23 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Amount-properties-amount + currency: + description: The ISO-4217 currency code for the amount. + example: USD + type: string + x-konfig-original-example: USD + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Amount-properties-currency + UnitsNullable: + description: Trade Units. Cannot work with notional value. + nullable: true + type: number + TimeNullable: + description: Time + example: 2022-01-21T20:11:19.217Z + nullable: true + type: string + x-konfig-original-example: 2022-01-21T20:11:19.217Z + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Time + CurrencyNullable: + additionalProperties: true + description: Describes a currency object. + example: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + nullable: true + properties: + id: + description: Unique identifier for the currency. This is the UUID used to + reference the currency in SnapTrade. + example: 87b24961-b51e-4db8-9226-f198f6518a89 + format: uuid + type: string + x-konfig-original-example: 87b24961-b51e-4db8-9226-f198f6518a89 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Currency-properties-id + code: + description: The ISO-4217 currency code for the currency. + example: USD + type: string + x-konfig-original-example: USD + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Currency-properties-code + name: + description: A human-friendly name of the currency. + example: US Dollar + type: string + x-konfig-original-example: US Dollar + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Currency-properties-name + type: object + AccountBalanceNullable: + description: Contains balance related information for the account. + example: + total: + amount: 15363.23 + currency: USD + nullable: true + properties: + total: + $ref: '#/components/schemas/AmountNullable' + FigiInstrumentNullable: + additionalProperties: true + description: Open FIGI Identifiers + example: + figi_code: BBG000B9Y5X2 + figi_share_class: BBG001S5N8V8 + nullable: true + properties: + figi_code: + example: BBG000B9Y5X2 + nullable: true + type: string + x-konfig-original-example: BBG000B9Y5X2 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-FigiInstrument-properties-figi_code + figi_share_class: + example: BBG001S5N8V8 + nullable: true + type: string + x-konfig-original-example: BBG001S5N8V8 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-FigiInstrument-properties-figi_share_class + type: object + UniversalSymbolNullable: + additionalProperties: true + description: Universal symbol + nullable: true + properties: + id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + symbol: + example: VAB.TO + type: string + x-konfig-original-example: VAB.TO + x-konfig-generated-schema: konfig-generated-schema-components-schemas-UniversalSymbol-properties-symbol + raw_symbol: + example: VAB + type: string + x-konfig-original-example: VAB + x-konfig-generated-schema: konfig-generated-schema-components-schemas-UniversalSymbol-properties-raw_symbol + description: + example: VANGUARD CDN AGGREGATE BOND INDEX ETF + nullable: true + type: string + x-konfig-original-example: VANGUARD CDN AGGREGATE BOND INDEX ETF + x-konfig-generated-schema: konfig-generated-schema-components-schemas-UniversalSymbol-properties-description + currency: + $ref: '#/components/schemas/Currency' + exchange: + $ref: '#/components/schemas/Exchange' + type: + $ref: '#/components/schemas/SecurityType' + currencies: + items: + $ref: '#/components/schemas/Currency' + type: array + figi_code: + example: BBG000B9XRY4 + nullable: true + type: string + x-konfig-original-example: BBG000B9XRY4 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-UniversalSymbol-properties-figi_code + figi_instrument: + $ref: '#/components/schemas/FigiInstrumentNullable' + required: + - currencies + - currency + - id + - raw_symbol + - symbol + - type + type: object + x-konfig-is-used-in-successful-response: true + OptionsSymbolNullable: + additionalProperties: true + description: Options Symbol + nullable: true + properties: + id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + ticker: + example: SPY 220819P00200000 + type: string + x-konfig-original-example: SPY 220819P00200000 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-OptionsSymbol-properties-ticker + option_type: + enum: + - CALL + - PUT + example: CALL + type: string + x-konfig-original-example: CALL + x-konfig-generated-schema: konfig-generated-schema-components-schemas-OptionsSymbol-properties-option_type + strike_price: + example: 200 + type: number + x-konfig-original-example: 200 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-OptionsSymbol-properties-strike_price + expiration_date: + example: 2017-07-17T15:13:07.177712+00:00 + format: datetime + type: string + x-konfig-original-example: 2017-07-17T15:13:07.177712+00:00 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-OptionsSymbol-properties-expiration_date + is_mini_option: + example: false + type: boolean + x-konfig-original-example: false + x-konfig-generated-schema: konfig-generated-schema-components-schemas-OptionsSymbol-properties-is_mini_option + underlying_symbol: + $ref: '#/components/schemas/UnderlyingSymbol' + local_id: + example: "40817960" + type: string + x-konfig-original-example: "40817960" + x-konfig-generated-schema: konfig-generated-schema-components-schemas-OptionsSymbol-properties-local_id + exchange_id: + format: uuid + type: string + required: + - expiration_date + - id + - option_type + - strike_price + - ticker + - underlying_symbol + type: object + NotionalValueNullable: {} + Trading_cancelUserAccountOrder_request: + properties: + brokerage_order_id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + type: object + Options_getOptionStrategy_request: + properties: + underlying_symbol_id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + legs: + items: + $ref: '#/components/schemas/OptionLeg' + type: array + strategy_type: + enum: + - CUSTOM + type: string + required: + - legs + - strategy_type + - underlying_symbol_id + type: object + Options_placeOptionStrategy_request: + properties: + order_type: + $ref: '#/components/schemas/OrderTypeStrict' + time_in_force: + $ref: '#/components/schemas/TimeInForceStrict' + price: + description: Trade Price if limit or stop limit order + example: 31.33 + nullable: true + type: number + x-konfig-original-example: 31.33 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Price + required: + - order_type + - time_in_force + type: object + StrategyImpact_legs_inner: + additionalProperties: true + properties: + legId: + example: 0 + format: int32 + type: integer + x-konfig-original-example: 0 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyImpact-properties-legs-items-properties-legId + symbol: + example: AC21Oct22C30.00.MX + type: string + x-konfig-original-example: AC21Oct22C30.00.MX + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyImpact-properties-legs-items-properties-symbol + symbolId: + example: 41790511 + format: int32 + type: integer + x-konfig-original-example: 41790511 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyImpact-properties-legs-items-properties-symbolId + legRatioQuantity: + example: 1 + format: int32 + type: integer + x-konfig-original-example: 1 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyImpact-properties-legs-items-properties-legRatioQuantity + side: + example: BTO + type: string + x-konfig-original-example: BTO + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyImpact-properties-legs-items-properties-side + avgExecPrice: + format: nullable + type: string + lastExecPrice: + format: nullable + type: string + type: object + StrategyOrderPlace_orders_inner_legs_inner: + additionalProperties: true + properties: + legId: + example: 0 + format: int32 + type: integer + x-konfig-original-example: 0 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-legs-items-properties-legId + symbol: + example: AC21Oct22C30.00.MX + type: string + x-konfig-original-example: AC21Oct22C30.00.MX + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-legs-items-properties-symbol + symbolId: + example: 41790511 + format: int32 + type: integer + x-konfig-original-example: 41790511 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-legs-items-properties-symbolId + legRatioQuantity: + example: 1 + format: int32 + type: integer + x-konfig-original-example: 1 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-legs-items-properties-legRatioQuantity + side: + example: BTO + type: string + x-konfig-original-example: BTO + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-legs-items-properties-side + avgExecPrice: + example: 0 + format: int32 + type: integer + x-konfig-original-example: 0 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-legs-items-properties-avgExecPrice + lastExecPrice: + format: nullable + type: string + type: object + StrategyOrderPlace_orders_inner: + additionalProperties: true + properties: + id: + example: 1069605761 + format: int32 + type: integer + x-konfig-original-example: 1069605761 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-id + symbol: + example: AC.TO + type: string + x-konfig-original-example: AC.TO + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-symbol + symbolId: + example: 7960447 + format: int32 + type: integer + x-konfig-original-example: 7960447 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-symbolId + totalQuantity: + example: 1 + format: int32 + type: integer + x-konfig-original-example: 1 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-totalQuantity + openQuantity: + example: 1 + format: int32 + type: integer + x-konfig-original-example: 1 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-openQuantity + filledQuantity: + example: 0 + format: int32 + type: integer + x-konfig-original-example: 0 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-filledQuantity + canceledQuantity: + example: 0 + format: int32 + type: integer + x-konfig-original-example: 0 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-canceledQuantity + side: + example: Buy + type: string + x-konfig-original-example: Buy + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-side + orderType: + example: Market + type: string + x-konfig-original-example: Market + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-orderType + limitPrice: + format: nullable + type: string + stopPrice: + format: nullable + type: string + isAllOrNone: + type: boolean + isAnonymous: + type: boolean + icebergQuantity: + format: nullable + type: string + minQuantity: + format: nullable + type: string + avgExecPrice: + example: 0 + format: int32 + type: integer + x-konfig-original-example: 0 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-avgExecPrice + lastExecPrice: + format: nullable + type: string + source: + example: TradingAPI + type: string + x-konfig-original-example: TradingAPI + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-source + timeInForce: + example: Day + type: string + x-konfig-original-example: Day + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-timeInForce + gtdDate: + format: nullable + type: string + state: + example: Pending + type: string + x-konfig-original-example: Pending + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-state + rejectionReason: + example: None + type: string + x-konfig-original-example: None + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-rejectionReason + chainId: + example: 1069605761 + format: int32 + type: integer + x-konfig-original-example: 1069605761 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-chainId + creationTime: + example: 2022-07-19T19:53:47.915Z + type: string + x-konfig-original-example: 2022-07-19T19:53:47.915Z + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-creationTime + updateTime: + example: 2022-07-19T19:53:47.939Z + type: string + x-konfig-original-example: 2022-07-19T19:53:47.939Z + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-updateTime + notes: + example: None + type: string + x-konfig-original-example: None + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-notes + primaryRoute: + example: AUTO + type: string + x-konfig-original-example: AUTO + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-primaryRoute + secondaryRoute: + example: AUTO + type: string + x-konfig-original-example: AUTO + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-secondaryRoute + orderRoute: + example: MX + type: string + x-konfig-original-example: MX + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-orderRoute + venueHoldingOrder: + example: None + type: string + x-konfig-original-example: None + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-venueHoldingOrder + comissionCharged: + example: 0 + format: int32 + type: integer + x-konfig-original-example: 0 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-comissionCharged + exchangeOrderId: + example: None + type: string + x-konfig-original-example: None + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-exchangeOrderId + isSignificantShareHolder: + type: boolean + isInsider: + type: boolean + isLimitOffsetInDollar: + type: boolean + userId: + example: 514603 + format: int32 + type: integer + x-konfig-original-example: 514603 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-userId + placementCommission: + format: nullable + type: string + legs: + items: + $ref: '#/components/schemas/StrategyOrderPlace_orders_inner_legs_inner' + type: array + strategyType: + example: Strangle + type: string + x-konfig-original-example: Strangle + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-strategyType + triggerStopPrice: + format: nullable + type: string + orderGroupId: + example: 0 + format: int32 + type: integer + x-konfig-original-example: 0 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyOrderPlace-properties-orders-items-properties-orderGroupId + orderClass: + format: nullable + type: string + isCrossZero: + type: boolean + type: object + OptionStrategy_legs_inner: + example: + quantity: 10 + index: 1 + action: BUY_TO_OPEN + option_symbol_id: AAPLC20221111 + properties: + option_symbol_id: + example: AAPLC20221111 + type: string + x-konfig-original-example: AAPLC20221111 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-OptionStrategy-properties-legs-items-properties-option_symbol_id + index: + example: 1 + type: number + x-konfig-original-example: 1 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-OptionStrategy-properties-legs-items-properties-index + action: + example: BUY_TO_OPEN + type: string + x-konfig-original-example: BUY_TO_OPEN + x-konfig-generated-schema: konfig-generated-schema-components-schemas-OptionStrategy-properties-legs-items-properties-action + quantity: + example: 10 + type: number + x-konfig-original-example: 10 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-OptionStrategy-properties-legs-items-properties-quantity + StrategyQuotes_greek: + additionalProperties: true + example: + delta: 0.1 + rho: 0.1 + theta: 0.1 + gamma: 0.1 + vega: 0.1 + properties: + delta: + example: 0.1 + type: number + x-konfig-original-example: 0.1 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyQuotes-properties-greek-properties-delta + gamma: + example: 0.1 + type: number + x-konfig-original-example: 0.1 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyQuotes-properties-greek-properties-gamma + theta: + example: 0.1 + type: number + x-konfig-original-example: 0.1 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyQuotes-properties-greek-properties-theta + vega: + example: 0.1 + type: number + x-konfig-original-example: 0.1 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyQuotes-properties-greek-properties-vega + rho: + example: 0.1 + type: number + x-konfig-original-example: 0.1 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-StrategyQuotes-properties-greek-properties-rho + type: object + BrokerageAuthorizationTypeReadOnly_brokerage: + additionalProperties: true + example: + name: Questrade + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + slug: QUESTRADE + properties: + id: + example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + format: uuid + type: string + x-konfig-original-example: 2bcd7cc3-e922-4976-bce1-9858296801c3 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-Id + name: + description: Full name of the brokerage. + example: Questrade + type: string + x-konfig-original-example: Questrade + x-konfig-generated-schema: konfig-generated-schema-components-schemas-BrokerageAuthorizationTypeReadOnly-properties-brokerage-properties-name + slug: + description: A unique identifier for that brokerage. It is usually the name + of the brokerage in capital letters and will never change. + example: QUESTRADE + type: string + x-konfig-original-example: QUESTRADE + x-konfig-generated-schema: konfig-generated-schema-components-schemas-BrokerageAuthorizationTypeReadOnly-properties-brokerage-properties-slug + type: object + OptionChain_inner_chainPerRoot_inner_chainPerStrikePrice_inner: + additionalProperties: true + example: + callSymbolId: 42816081 + putSymbolId: 42816129 + strikePrice: 70 + properties: + strikePrice: + example: 70 + format: int32 + nullable: true + type: integer + x-konfig-original-example: 70 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-OptionChain-items-properties-chainPerRoot-items-properties-chainPerStrikePrice-items-properties-strikePrice + callSymbolId: + example: 42816081 + format: int32 + nullable: true + type: integer + x-konfig-original-example: 42816081 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-OptionChain-items-properties-chainPerRoot-items-properties-chainPerStrikePrice-items-properties-callSymbolId + putSymbolId: + example: 42816129 + format: int32 + nullable: true + type: integer + x-konfig-original-example: 42816129 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-OptionChain-items-properties-chainPerRoot-items-properties-chainPerStrikePrice-items-properties-putSymbolId + type: object + OptionChain_inner_chainPerRoot_inner: + additionalProperties: true + example: + chainPerStrikePrice: + - callSymbolId: 42816081 + putSymbolId: 42816129 + strikePrice: 70 + - callSymbolId: 42816081 + putSymbolId: 42816129 + strikePrice: 70 + multiplier: 100 + optionRoot: AAPL + properties: + optionRoot: + example: AAPL + type: string + x-konfig-original-example: AAPL + x-konfig-generated-schema: konfig-generated-schema-components-schemas-OptionChain-items-properties-chainPerRoot-items-properties-optionRoot + chainPerStrikePrice: + items: + $ref: '#/components/schemas/OptionChain_inner_chainPerRoot_inner_chainPerStrikePrice_inner' + type: array + multiplier: + example: 100 + format: int32 + type: integer + x-konfig-original-example: 100 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-OptionChain-items-properties-chainPerRoot-items-properties-multiplier + type: object + OptionChain_inner: + additionalProperties: true + example: + expiryDate: 2022-07-08T04:00:00.000Z + chainPerRoot: + - chainPerStrikePrice: + - callSymbolId: 42816081 + putSymbolId: 42816129 + strikePrice: 70 + - callSymbolId: 42816081 + putSymbolId: 42816129 + strikePrice: 70 + multiplier: 100 + optionRoot: AAPL + - chainPerStrikePrice: + - callSymbolId: 42816081 + putSymbolId: 42816129 + strikePrice: 70 + - callSymbolId: 42816081 + putSymbolId: 42816129 + strikePrice: 70 + multiplier: 100 + optionRoot: AAPL + optionExerciseType: American + description: APPLE INC + listingExchange: OPRA + properties: + expiryDate: + example: 2022-07-08T04:00:00.000Z + type: string + x-konfig-original-example: 2022-07-08T04:00:00.000Z + x-konfig-generated-schema: konfig-generated-schema-components-schemas-OptionChain-items-properties-expiryDate + description: + example: APPLE INC + type: string + x-konfig-original-example: APPLE INC + x-konfig-generated-schema: konfig-generated-schema-components-schemas-OptionChain-items-properties-description + listingExchange: + example: OPRA + type: string + x-konfig-original-example: OPRA + x-konfig-generated-schema: konfig-generated-schema-components-schemas-OptionChain-items-properties-listingExchange + optionExerciseType: + example: American + type: string + x-konfig-original-example: American + x-konfig-generated-schema: konfig-generated-schema-components-schemas-OptionChain-items-properties-optionExerciseType + chainPerRoot: + items: + $ref: '#/components/schemas/OptionChain_inner_chainPerRoot_inner' + type: array + type: object + SymbolsQuotes_inner: + example: + symbol: + figi_code: BBG000B9XRY4 + symbol: VAB.TO + figi_instrument: + figi_code: BBG000B9Y5X2 + figi_share_class: BBG001S5N8V8 + raw_symbol: VAB + description: VANGUARD CDN AGGREGATE BOND INDEX ETF + currency: + code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + exchange: + start_time: 09:30:00 + mic_code: XTSE + code: TSX + timezone: America/New_York + name: Toronto Stock Exchange + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + close_time: "57600" + suffix: .TO + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + type: + is_supported: true + code: cs + description: Common Stock + id: 2bcd7cc3-e922-4976-bce1-9858296801c3 + currencies: + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + - code: USD + name: US Dollar + id: 87b24961-b51e-4db8-9226-f198f6518a89 + last_trade_price: 8.74 + ask_size: 344 + bid_size: 260 + bid_price: 8.43 + ask_price: 8.43 + properties: + symbol: + $ref: '#/components/schemas/UniversalSymbol' + bid_price: + example: 8.43 + type: number + x-konfig-original-example: 8.43 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SymbolsQuotes-items-properties-bid_price + ask_price: + example: 8.43 + type: number + x-konfig-original-example: 8.43 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SymbolsQuotes-items-properties-ask_price + last_trade_price: + example: 8.74 + type: number + x-konfig-original-example: 8.74 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SymbolsQuotes-items-properties-last_trade_price + bid_size: + example: 260 + type: number + x-konfig-original-example: 260 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SymbolsQuotes-items-properties-bid_size + ask_size: + example: 344 + type: number + x-konfig-original-example: 344 + x-konfig-generated-schema: konfig-generated-schema-components-schemas-SymbolsQuotes-items-properties-ask_size + encryptedResponse_encryptedMessageData: + additionalProperties: true + properties: + encryptedMessage: + example: 9Xy05vqZOfp0OpW5fLAaDw== + type: string + x-konfig-original-example: 9Xy05vqZOfp0OpW5fLAaDw== + x-konfig-generated-schema: konfig-generated-schema-components-schemas-encryptedResponse-properties-encryptedMessageData-properties-encryptedMessage + tag: + example: mWZPkpQh5ktbcz6N7cTRmQ== + type: string + x-konfig-original-example: mWZPkpQh5ktbcz6N7cTRmQ== + x-konfig-generated-schema: konfig-generated-schema-components-schemas-encryptedResponse-properties-encryptedMessageData-properties-tag + nonce: + example: None + type: string + x-konfig-original-example: None + x-konfig-generated-schema: konfig-generated-schema-components-schemas-encryptedResponse-properties-encryptedMessageData-properties-nonce + type: object + securitySchemes: + PartnerSignature: + in: header + name: Signature + type: apiKey + PartnerClientId: + in: query + name: clientId + type: apiKey + PartnerTimestamp: + in: query + name: timestamp + type: apiKey + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/build.gradle b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/build.gradle new file mode 100644 index 0000000000..8371cd5b2f --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/build.gradle @@ -0,0 +1,168 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' +apply plugin: 'java' +apply plugin: 'com.diffplug.spotless' + +group = 'com.konfigthis' +version = '5.0.30' + +buildscript { + repositories { + mavenCentral() + } + dependencies { + classpath 'com.android.tools.build:gradle:2.3.+' + classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' + classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.11.0' + } +} + +repositories { + mavenCentral() +} +sourceSets { + main.java.srcDirs = ['src/main/java'] +} + +if(hasProperty('target') && target == 'android') { + + apply plugin: 'com.android.library' + apply plugin: 'com.github.dcendents.android-maven' + + android { + compileSdkVersion 25 + buildToolsVersion '25.0.2' + defaultConfig { + minSdkVersion 14 + targetSdkVersion 25 + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + // Rename the aar correctly + libraryVariants.all { variant -> + variant.outputs.each { output -> + def outputFile = output.outputFile + if (outputFile != null && outputFile.name.endsWith('.aar')) { + def fileName = "${project.name}-${variant.baseName}-${version}.aar" + output.outputFile = new File(outputFile.parent, fileName) + } + } + } + + dependencies { + provided "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + } + } + + afterEvaluate { + android.libraryVariants.all { variant -> + def task = project.tasks.create "jar${variant.name.capitalize()}", Jar + task.description = "Create jar artifact for ${variant.name}" + task.dependsOn variant.javaCompile + task.from variant.javaCompile.destinationDir + task.destinationDir = project.file("${project.buildDir}/outputs/jar") + task.archiveName = "${project.name}-${variant.baseName}-${version}.jar" + artifacts.add('archives', task) + } + } + + task sourcesJar(type: Jar) { + from android.sourceSets.main.java.srcDirs + classifier = 'sources' + } + + artifacts { + archives sourcesJar + } + +} else { + + apply plugin: 'java' + apply plugin: 'maven-publish' + + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + + publishing { + publications { + maven(MavenPublication) { + artifactId = 'snaptrade-java-sdk' + from components.java + } + } + } + + task execute(type:JavaExec) { + main = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath + } +} + +ext { + jakarta_annotation_version = "1.3.5" +} + +dependencies { + implementation 'io.swagger:swagger-annotations:1.6.8' + implementation "com.google.code.findbugs:jsr305:3.0.2" + implementation 'com.squareup.okhttp3:okhttp:4.10.0' + implementation 'com.squareup.okhttp3:logging-interceptor:4.10.0' + implementation 'com.google.code.gson:gson:2.9.1' + implementation 'io.gsonfire:gson-fire:1.8.5' + implementation 'javax.ws.rs:jsr311-api:1.1.1' + implementation 'javax.ws.rs:javax.ws.rs-api:2.1.1' + implementation 'org.openapitools:jackson-databind-nullable:0.2.4' + implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0' + implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.1' + testImplementation 'org.mockito:mockito-core:3.12.4' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.1' +} + +javadoc { + options.tags = [ "http.response.details:a:Http Response Details" ] +} + +// Use spotless plugin to automatically format code, remove unused import, etc +// To apply changes directly to the file, run `gradlew spotlessApply` +// Ref: https://github.com/diffplug/spotless/tree/main/plugin-gradle +spotless { + // comment out below to run spotless as part of the `check` task + enforceCheck false + + format 'misc', { + // define the files (e.g. '*.gradle', '*.md') to apply `misc` to + target '.gitignore' + + // define the steps to apply to those files + trimTrailingWhitespace() + indentWithSpaces() // Takes an integer argument if you don't like 4 + endWithNewline() + } + java { + // don't need to set target, it is inferred from java + + // apply a specific flavor of google-java-format + googleJavaFormat('1.8').aosp().reflowLongStrings() + + removeUnusedImports() + importOrder() + } +} + +test { + // Enable JUnit 5 (Gradle 4.6+). + useJUnitPlatform() + + // Always run tests, even when nothing changed. + dependsOn 'cleanTest' + + // Show test results. + testLogging { + events "passed", "skipped", "failed" + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/build.sbt b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/build.sbt new file mode 100644 index 0000000000..18e213bfa5 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/build.sbt @@ -0,0 +1,28 @@ +lazy val root = (project in file(".")). + settings( + organization := "com.konfigthis", + name := "snaptrade-java-sdk", + version := "5.0.30", + scalaVersion := "2.11.4", + scalacOptions ++= Seq("-feature"), + javacOptions in compile ++= Seq("-Xlint:deprecation"), + publishArtifact in (Compile, packageDoc) := false, + resolvers += Resolver.mavenLocal, + libraryDependencies ++= Seq( + "io.swagger" % "swagger-annotations" % "1.6.5", + "com.squareup.okhttp3" % "okhttp" % "4.10.0", + "com.squareup.okhttp3" % "logging-interceptor" % "4.10.0", + "com.google.code.gson" % "gson" % "2.9.1", + "org.apache.commons" % "commons-lang3" % "3.12.0", + "javax.ws.rs" % "jsr311-api" % "1.1.1", + "javax.ws.rs" % "javax.ws.rs-api" % "2.1.1", + "org.openapitools" % "jackson-databind-nullable" % "0.2.4", + "io.gsonfire" % "gson-fire" % "1.8.5" % "compile", + "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", + "com.google.code.findbugs" % "jsr305" % "3.0.2" % "compile", + "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", + "org.junit.jupiter" % "junit-jupiter-api" % "5.9.1" % "test", + "com.novocode" % "junit-interface" % "0.10" % "test", + "org.mockito" % "mockito-core" % "3.12.4" % "test" + ) + ) diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/Account.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/Account.md new file mode 100644 index 0000000000..b4aa0f6cd2 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/Account.md @@ -0,0 +1,24 @@ + + +# Account + +SnapTradeUser Investment Account + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **UUID** | | [optional] | +|**brokerageAuthorization** | **UUID** | | [optional] | +|**portfolioGroup** | **UUID** | | [optional] | +|**name** | **String** | | [optional] | +|**number** | **String** | | [optional] | +|**institutionName** | **String** | | [optional] | +|**createdDate** | **String** | | [optional] | +|**meta** | **Map<String, Object>** | | [optional] | +|**cashRestrictions** | [**List<CashRestriction>**](CashRestriction.md) | | [optional] | +|**syncStatus** | [**AccountSyncStatus**](AccountSyncStatus.md) | | [optional] | +|**balance** | [**AccountBalance**](AccountBalance.md) | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/AccountBalance.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/AccountBalance.md new file mode 100644 index 0000000000..5142333a92 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/AccountBalance.md @@ -0,0 +1,14 @@ + + +# AccountBalance + +Contains balance related information for the account. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**total** | [**AmountNullable**](AmountNullable.md) | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/AccountBalanceNullable.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/AccountBalanceNullable.md new file mode 100644 index 0000000000..2981727732 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/AccountBalanceNullable.md @@ -0,0 +1,14 @@ + + +# AccountBalanceNullable + +Contains balance related information for the account. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**total** | [**AmountNullable**](AmountNullable.md) | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/AccountHoldings.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/AccountHoldings.md new file mode 100644 index 0000000000..7e40d43de4 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/AccountHoldings.md @@ -0,0 +1,17 @@ + + +# AccountHoldings + +Account Holdings + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**account** | [**SnapTradeHoldingsAccount**](SnapTradeHoldingsAccount.md) | | [optional] | +|**balances** | [**List<Balance>**](Balance.md) | | [optional] | +|**positions** | [**List<Position>**](Position.md) | | [optional] | +|**totalValue** | [**SnapTradeHoldingsTotalValue**](SnapTradeHoldingsTotalValue.md) | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/AccountHoldingsAccount.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/AccountHoldingsAccount.md new file mode 100644 index 0000000000..39f1e9bad8 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/AccountHoldingsAccount.md @@ -0,0 +1,19 @@ + + +# AccountHoldingsAccount + +A wrapper object containing holdings information for a single account + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**account** | [**SnapTradeHoldingsAccountAccountId**](SnapTradeHoldingsAccountAccountId.md) | | [optional] | +|**balances** | [**List<Balance>**](Balance.md) | List of balances for the account. Each element of the list has a distinct currency. Some brokerages like Questrade [allows holding multiple currencies in the same account](https://www.questrade.com/learning/questrade-basics/balances-and-reports/understanding-your-account-balances). | [optional] | +|**positions** | [**List<Position>**](Position.md) | List of stock/ETF/crypto/mutual fund positions in the account. | [optional] | +|**optionPositions** | [**List<OptionsPosition>**](OptionsPosition.md) | List of option positions in the account. | [optional] | +|**orders** | [**List<AccountOrderRecord>**](AccountOrderRecord.md) | List of recent orders in the account, including both pending and executed orders. | [optional] | +|**totalValue** | [**SnapTradeHoldingsTotalValue**](SnapTradeHoldingsTotalValue.md) | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/AccountInformationApi.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/AccountInformationApi.md new file mode 100644 index 0000000000..9be1825f4b --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/AccountInformationApi.md @@ -0,0 +1,816 @@ +# AccountInformationApi + +All URIs are relative to *https://api.snaptrade.com/api/v1* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**getAllUserHoldings**](AccountInformationApi.md#getAllUserHoldings) | **GET** /holdings | List all accounts for the user, plus balances, positions, and orders for each account. | +| [**getUserAccountBalance**](AccountInformationApi.md#getUserAccountBalance) | **GET** /accounts/{accountId}/balances | List account balances | +| [**getUserAccountDetails**](AccountInformationApi.md#getUserAccountDetails) | **GET** /accounts/{accountId} | Return details of a specific investment account | +| [**getUserAccountOrders**](AccountInformationApi.md#getUserAccountOrders) | **GET** /accounts/{accountId}/orders | List account orders | +| [**getUserAccountPositions**](AccountInformationApi.md#getUserAccountPositions) | **GET** /accounts/{accountId}/positions | List account positions | +| [**getUserHoldings**](AccountInformationApi.md#getUserHoldings) | **GET** /accounts/{accountId}/holdings | List account holdings | +| [**listUserAccounts**](AccountInformationApi.md#listUserAccounts) | **GET** /accounts | List accounts | +| [**updateUserAccount**](AccountInformationApi.md#updateUserAccount) | **PUT** /accounts/{accountId} | Update details of an investment account | + + + +# **getAllUserHoldings** +> List<AccountHoldings> getAllUserHoldings(userId, userSecret).brokerageAuthorizations(brokerageAuthorizations).execute(); + +List all accounts for the user, plus balances, positions, and orders for each account. + +**Deprecated, please use the account-specific holdings endpoint instead.** List all accounts for the user, plus balances, positions, and orders for each account. + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.AccountInformationApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + String userId = "userId_example"; + String userSecret = "userSecret_example"; + UUID brokerageAuthorizations = UUID.fromString("917c8734-8470-4a3e-a18f-57c3f2ee6631"); // Optional. Comma seperated list of authorization IDs (only use if filtering is needed on one or more authorizations). + try { + List result = client + .accountInformation + .getAllUserHoldings(userId, userSecret) + .brokerageAuthorizations(brokerageAuthorizations) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AccountInformationApi#getAllUserHoldings"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse> response = client + .accountInformation + .getAllUserHoldings(userId, userSecret) + .brokerageAuthorizations(brokerageAuthorizations) + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling AccountInformationApi#getAllUserHoldings"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **userId** | **String**| | | +| **userSecret** | **String**| | | +| **brokerageAuthorizations** | **UUID**| Optional. Comma seperated list of authorization IDs (only use if filtering is needed on one or more authorizations). | [optional] | + +### Return type + +[**List<AccountHoldings>**](AccountHoldings.md) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Returns list of accounts and holdings | - | +| **500** | Unexpected Error | - | + + +# **getUserAccountBalance** +> List<Balance> getUserAccountBalance(userId, userSecret, accountId).execute(); + +List account balances + +A list of account balances for the specified account (one per currency that the account holds). + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.AccountInformationApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + String userId = "userId_example"; + String userSecret = "userSecret_example"; + UUID accountId = UUID.fromString("917c8734-8470-4a3e-a18f-57c3f2ee6631"); // The ID of the account to get balances. + try { + List result = client + .accountInformation + .getUserAccountBalance(userId, userSecret, accountId) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AccountInformationApi#getUserAccountBalance"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse> response = client + .accountInformation + .getUserAccountBalance(userId, userSecret, accountId) + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling AccountInformationApi#getUserAccountBalance"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **userId** | **String**| | | +| **userSecret** | **String**| | | +| **accountId** | **UUID**| The ID of the account to get balances. | | + +### Return type + +[**List<Balance>**](Balance.md) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | List of all balances in investment account | - | +| **0** | Unexpected error | - | + + +# **getUserAccountDetails** +> Account getUserAccountDetails(userId, userSecret, accountId).execute(); + +Return details of a specific investment account + +Returns an account object with details for the specified account, including the total account market value. + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.AccountInformationApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + String userId = "userId_example"; + String userSecret = "userSecret_example"; + UUID accountId = UUID.fromString("917c8734-8470-4a3e-a18f-57c3f2ee6631"); // The ID of the account to get detail of. + try { + Account result = client + .accountInformation + .getUserAccountDetails(userId, userSecret, accountId) + .execute(); + System.out.println(result); + System.out.println(result.getId()); + System.out.println(result.getBrokerageAuthorization()); + System.out.println(result.getPortfolioGroup()); + System.out.println(result.getName()); + System.out.println(result.getNumber()); + System.out.println(result.getInstitutionName()); + System.out.println(result.getCreatedDate()); + System.out.println(result.getMeta()); + System.out.println(result.getCashRestrictions()); + System.out.println(result.getSyncStatus()); + System.out.println(result.getBalance()); + } catch (ApiException e) { + System.err.println("Exception when calling AccountInformationApi#getUserAccountDetails"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse response = client + .accountInformation + .getUserAccountDetails(userId, userSecret, accountId) + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling AccountInformationApi#getUserAccountDetails"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **userId** | **String**| | | +| **userSecret** | **String**| | | +| **accountId** | **UUID**| The ID of the account to get detail of. | | + +### Return type + +[**Account**](Account.md) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Details of a specific investment account | - | +| **0** | Unexpected error | - | + + +# **getUserAccountOrders** +> List<AccountOrderRecord> getUserAccountOrders(userId, userSecret, accountId).state(state).days(days).execute(); + +List account orders + +Fetch all recent orders from a user's account. + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.AccountInformationApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + String userId = "userId_example"; + String userSecret = "userSecret_example"; + UUID accountId = UUID.fromString("917c8734-8470-4a3e-a18f-57c3f2ee6631"); // The ID of the account to get orders. + String state = "all"; // defaults value is set to \"all\" + Integer days = 30; // Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. + try { + List result = client + .accountInformation + .getUserAccountOrders(userId, userSecret, accountId) + .state(state) + .days(days) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AccountInformationApi#getUserAccountOrders"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse> response = client + .accountInformation + .getUserAccountOrders(userId, userSecret, accountId) + .state(state) + .days(days) + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling AccountInformationApi#getUserAccountOrders"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **userId** | **String**| | | +| **userSecret** | **String**| | | +| **accountId** | **UUID**| The ID of the account to get orders. | | +| **state** | **String**| defaults value is set to \"all\" | [optional] [enum: all, open, executed] | +| **days** | **Integer**| Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. | [optional] | + +### Return type + +[**List<AccountOrderRecord>**](AccountOrderRecord.md) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | List all orders in account | - | + + +# **getUserAccountPositions** +> List<Position> getUserAccountPositions(userId, userSecret, accountId).execute(); + +List account positions + +Returns a list of positions in the specified account. + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.AccountInformationApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + String userId = "userId_example"; + String userSecret = "userSecret_example"; + UUID accountId = UUID.fromString("917c8734-8470-4a3e-a18f-57c3f2ee6631"); // The ID of the account to get positions. + try { + List result = client + .accountInformation + .getUserAccountPositions(userId, userSecret, accountId) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AccountInformationApi#getUserAccountPositions"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse> response = client + .accountInformation + .getUserAccountPositions(userId, userSecret, accountId) + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling AccountInformationApi#getUserAccountPositions"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **userId** | **String**| | | +| **userSecret** | **String**| | | +| **accountId** | **UUID**| The ID of the account to get positions. | | + +### Return type + +[**List<Position>**](Position.md) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | List all positions in investment account | - | +| **0** | Unexpected error | - | + + +# **getUserHoldings** +> AccountHoldingsAccount getUserHoldings(accountId, userId, userSecret).execute(); + +List account holdings + +Lists balances, positions, option positions, and recent orders for the specified account. The data returned is similar to the data returned over the more fine-grained [balances](/reference/Account%20Information/AccountInformation_getUserAccountBalance), [positions](/reference/Account%20Information/AccountInformation_getUserAccountPositions) and [orders](/reference/Account%20Information/AccountInformation_getUserAccountOrders) endpoints. __The finer-grained APIs are preferred. They are easier to work with, faster, and have better error handling than this coarse-grained API.__ + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.AccountInformationApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + UUID accountId = UUID.randomUUID(); + String userId = "userId_example"; + String userSecret = "userSecret_example"; + try { + AccountHoldingsAccount result = client + .accountInformation + .getUserHoldings(accountId, userId, userSecret) + .execute(); + System.out.println(result); + System.out.println(result.getAccount()); + System.out.println(result.getBalances()); + System.out.println(result.getPositions()); + System.out.println(result.getOptionPositions()); + System.out.println(result.getOrders()); + System.out.println(result.getTotalValue()); + } catch (ApiException e) { + System.err.println("Exception when calling AccountInformationApi#getUserHoldings"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse response = client + .accountInformation + .getUserHoldings(accountId, userId, userSecret) + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling AccountInformationApi#getUserHoldings"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **UUID**| | | +| **userId** | **String**| | | +| **userSecret** | **String**| | | + +### Return type + +[**AccountHoldingsAccount**](AccountHoldingsAccount.md) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **500** | Unexpected Error | - | + + +# **listUserAccounts** +> List<Account> listUserAccounts(userId, userSecret).execute(); + +List accounts + +Get a list of all Account objects for the authenticated SnapTrade user. + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.AccountInformationApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + String userId = "userId_example"; + String userSecret = "userSecret_example"; + try { + List result = client + .accountInformation + .listUserAccounts(userId, userSecret) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AccountInformationApi#listUserAccounts"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse> response = client + .accountInformation + .listUserAccounts(userId, userSecret) + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling AccountInformationApi#listUserAccounts"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **userId** | **String**| | | +| **userSecret** | **String**| | | + +### Return type + +[**List<Account>**](Account.md) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | A list of all Account objects for the authenticated user. | - | +| **0** | Unexpected error. | - | + + +# **updateUserAccount** +> List<Account> updateUserAccount(userId, userSecret, accountId).execute(); + +Update details of an investment account + +Updates various properties of a specified account. + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.AccountInformationApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + String userId = "userId_example"; + String userSecret = "userSecret_example"; + UUID accountId = UUID.randomUUID(); // The ID of the account to update. + try { + List result = client + .accountInformation + .updateUserAccount(userId, userSecret, accountId) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AccountInformationApi#updateUserAccount"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse> response = client + .accountInformation + .updateUserAccount(userId, userSecret, accountId) + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling AccountInformationApi#updateUserAccount"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **userId** | **String**| | | +| **userSecret** | **String**| | | +| **accountId** | **UUID**| The ID of the account to update. | | + +### Return type + +[**List<Account>**](Account.md) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successfully updated details of an investment account | - | +| **0** | Unexpected error | - | + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/AccountOrderRecord.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/AccountOrderRecord.md new file mode 100644 index 0000000000..82e6fefa96 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/AccountOrderRecord.md @@ -0,0 +1,32 @@ + + +# AccountOrderRecord + +Record of order in brokerageaccount + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**brokerageOrderId** | **String** | Order id returned by brokerage | [optional] | +|**status** | **AccountOrderRecordStatus** | | [optional] | +|**symbol** | **UUID** | | [optional] | +|**universalSymbol** | [**UniversalSymbol**](UniversalSymbol.md) | | [optional] | +|**optionSymbol** | [**OptionsSymbol**](OptionsSymbol.md) | | [optional] | +|**action** | **String** | Trade Action potential values include (but are not limited to) - BUY - SELL - BUY_COVER - SELL_SHORT - BUY_OPEN - BUY_CLOSE - SELL_OPEN - SELL_CLOSE | [optional] | +|**totalQuantity** | **Double** | Trade Units. Cannot work with notional value. | [optional] | +|**openQuantity** | **Double** | Trade Units | [optional] | +|**canceledQuantity** | **Double** | Trade Units | [optional] | +|**filledQuantity** | **Double** | Trade Units | [optional] | +|**executionPrice** | **Double** | Trade Price if limit or stop limit order | [optional] | +|**limitPrice** | **Double** | Trade Price if limit or stop limit order | [optional] | +|**stopPrice** | **Double** | Stop Price. If stop loss or stop limit order, the price to trigger the stop | [optional] | +|**orderType** | **String** | Order Type potential values include (but are not limited to) - Limit - Market - StopLimit - StopLoss | [optional] | +|**timeInForce** | **String** | Trade time in force examples: * FOK - Fill Or Kill * Day - Day * GTC - Good Til Canceled * GTD - Good Til Date | [optional] | +|**timePlaced** | **String** | Time | [optional] | +|**timeUpdated** | **String** | Time | [optional] | +|**timeExecuted** | **String** | Time | [optional] | +|**expiryDate** | **String** | Time | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/AccountOrderRecordStatus.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/AccountOrderRecordStatus.md new file mode 100644 index 0000000000..f80a7433dc --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/AccountOrderRecordStatus.md @@ -0,0 +1,49 @@ + + +# AccountOrderRecordStatus + +## Enum + + +* `NONE` (value: `"NONE"`) + +* `PENDING` (value: `"PENDING"`) + +* `ACCEPTED` (value: `"ACCEPTED"`) + +* `FAILED` (value: `"FAILED"`) + +* `REJECTED` (value: `"REJECTED"`) + +* `CANCELED` (value: `"CANCELED"`) + +* `PARTIAL_CANCELED` (value: `"PARTIAL_CANCELED"`) + +* `CANCEL_PENDING` (value: `"CANCEL_PENDING"`) + +* `EXECUTED` (value: `"EXECUTED"`) + +* `PARTIAL` (value: `"PARTIAL"`) + +* `REPLACE_PENDING` (value: `"REPLACE_PENDING"`) + +* `REPLACED` (value: `"REPLACED"`) + +* `STOPPED` (value: `"STOPPED"`) + +* `SUSPENDED` (value: `"SUSPENDED"`) + +* `EXPIRED` (value: `"EXPIRED"`) + +* `QUEUED` (value: `"QUEUED"`) + +* `TRIGGERED` (value: `"TRIGGERED"`) + +* `ACTIVATED` (value: `"ACTIVATED"`) + +* `PENDING_RISK_REVIEW` (value: `"PENDING_RISK_REVIEW"`) + +* `CONTINGENT_ORDER` (value: `"CONTINGENT_ORDER"`) + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/AccountSimple.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/AccountSimple.md new file mode 100644 index 0000000000..2184be0d89 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/AccountSimple.md @@ -0,0 +1,17 @@ + + +# AccountSimple + +SnapTradeUser Investment Account + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **UUID** | | [optional] | +|**name** | **String** | | [optional] | +|**number** | **String** | | [optional] | +|**syncStatus** | [**AccountSyncStatus**](AccountSyncStatus.md) | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/AccountSyncStatus.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/AccountSyncStatus.md new file mode 100644 index 0000000000..370b5dd1ca --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/AccountSyncStatus.md @@ -0,0 +1,15 @@ + + +# AccountSyncStatus + +Status of account + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**transactions** | [**TransactionsStatus**](TransactionsStatus.md) | | [optional] | +|**holdings** | [**HoldingsStatus**](HoldingsStatus.md) | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ActionStrict.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ActionStrict.md new file mode 100644 index 0000000000..54ed165b46 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ActionStrict.md @@ -0,0 +1,13 @@ + + +# ActionStrict + +## Enum + + +* `BUY` (value: `"BUY"`) + +* `SELL` (value: `"SELL"`) + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/Amount.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/Amount.md new file mode 100644 index 0000000000..7066e7afe2 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/Amount.md @@ -0,0 +1,15 @@ + + +# Amount + +Total value of the account, as reported by the brokerage + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**amount** | **Double** | Total value denominated in the currency of the `currency` field. | [optional] | +|**currency** | **String** | The ISO-4217 currency code for the amount. | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/AmountNullable.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/AmountNullable.md new file mode 100644 index 0000000000..df26b1247c --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/AmountNullable.md @@ -0,0 +1,15 @@ + + +# AmountNullable + +Total value of the account, as reported by the brokerage + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**amount** | **Double** | Total value denominated in the currency of the `currency` field. | [optional] | +|**currency** | **String** | The ISO-4217 currency code for the amount. | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ApiStatusApi.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ApiStatusApi.md new file mode 100644 index 0000000000..82f7868281 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ApiStatusApi.md @@ -0,0 +1,100 @@ +# ApiStatusApi + +All URIs are relative to *https://api.snaptrade.com/api/v1* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**check**](ApiStatusApi.md#check) | **GET** / | Get API Status | + + + +# **check** +> Status check().execute(); + +Get API Status + +Check whether the API is operational and verify timestamps. + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.ApiStatusApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + try { + Status result = client + .apiStatus + .check() + .execute(); + System.out.println(result); + System.out.println(result.getVersion()); + System.out.println(result.getTimestamp()); + System.out.println(result.getOnline()); + } catch (ApiException e) { + System.err.println("Exception when calling ApiStatusApi#check"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse response = client + .apiStatus + .check() + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling ApiStatusApi#check"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**Status**](Status.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | API is operational. | - | +| **0** | Unexpected error. | - | + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/AuthenticationApi.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/AuthenticationApi.md new file mode 100644 index 0000000000..75a7612fca --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/AuthenticationApi.md @@ -0,0 +1,503 @@ +# AuthenticationApi + +All URIs are relative to *https://api.snaptrade.com/api/v1* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**deleteSnapTradeUser**](AuthenticationApi.md#deleteSnapTradeUser) | **DELETE** /snapTrade/deleteUser | Delete SnapTrade user | +| [**listSnapTradeUsers**](AuthenticationApi.md#listSnapTradeUsers) | **GET** /snapTrade/listUsers | List SnapTrade users | +| [**loginSnapTradeUser**](AuthenticationApi.md#loginSnapTradeUser) | **POST** /snapTrade/login | Login user & generate connection link | +| [**registerSnapTradeUser**](AuthenticationApi.md#registerSnapTradeUser) | **POST** /snapTrade/registerUser | Create SnapTrade user | +| [**resetSnapTradeUserSecret**](AuthenticationApi.md#resetSnapTradeUserSecret) | **POST** /snapTrade/resetUserSecret | Obtain a new user secret for a user | + + + +# **deleteSnapTradeUser** +> DeleteUserResponse deleteSnapTradeUser(userId).execute(); + +Delete SnapTrade user + +Deletes a user you've registered over the SnapTrade API, and any data associated with them or their investment accounts. + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.AuthenticationApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + String userId = "userId_example"; + try { + DeleteUserResponse result = client + .authentication + .deleteSnapTradeUser(userId) + .execute(); + System.out.println(result); + System.out.println(result.getStatus()); + System.out.println(result.getUserId()); + } catch (ApiException e) { + System.err.println("Exception when calling AuthenticationApi#deleteSnapTradeUser"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse response = client + .authentication + .deleteSnapTradeUser(userId) + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling AuthenticationApi#deleteSnapTradeUser"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **userId** | **String**| | | + +### Return type + +[**DeleteUserResponse**](DeleteUserResponse.md) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Delete successful | - | +| **500** | Unexpected Error | - | + + +# **listSnapTradeUsers** +> List<String> listSnapTradeUsers().execute(); + +List SnapTrade users + +Returns a list of users you've registered over the SnapTrade API. + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.AuthenticationApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + try { + List result = client + .authentication + .listSnapTradeUsers() + .execute(); + } catch (ApiException e) { + System.err.println("Exception when calling AuthenticationApi#listSnapTradeUsers"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse> response = client + .authentication + .listSnapTradeUsers() + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling AuthenticationApi#listSnapTradeUsers"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**List<String>** + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successfully retrieved a list of users | - | + + +# **loginSnapTradeUser** +> Object loginSnapTradeUser(userId, userSecret).snapTradeLoginUserRequestBody(snapTradeLoginUserRequestBody).execute(); + +Login user & generate connection link + +Logs in a SnapTrade user and returns an authenticated connection portal URL for them to use to connect a brokerage account. + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.AuthenticationApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + String userId = "userId_example"; + String userSecret = "userSecret_example"; + String broker = "broker_example"; // Slug of the brokerage to connect the user to. See [this document](https://snaptrade.notion.site/SnapTrade-Brokerage-Integrations-f83946a714a84c3caf599f6a945f0ead) for a list of supported brokerages and their slugs. + Boolean immediateRedirect = true; // When set to True, user will be redirected back to the partner's site instead of the connection portal + String customRedirect = "customRedirect_example"; // URL to redirect the user to after the user connects their brokerage account + String reconnect = "reconnect_example"; // The UUID of the brokerage connection to be reconnected. This parameter should be left empty unless you are reconnecting a disabled connection. See ‘Reconnecting Accounts’ for more information. + String connectionType = "read"; // Sets whether the connection should be read or trade + String connectionPortalVersion = "v2"; // Sets the version of the connection portal to render, with a default to 'v3' + try { + Object result = client + .authentication + .loginSnapTradeUser(userId, userSecret) + .broker(broker) + .immediateRedirect(immediateRedirect) + .customRedirect(customRedirect) + .reconnect(reconnect) + .connectionType(connectionType) + .connectionPortalVersion(connectionPortalVersion) + .execute(); + } catch (ApiException e) { + System.err.println("Exception when calling AuthenticationApi#loginSnapTradeUser"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse response = client + .authentication + .loginSnapTradeUser(userId, userSecret) + .broker(broker) + .immediateRedirect(immediateRedirect) + .customRedirect(customRedirect) + .reconnect(reconnect) + .connectionType(connectionType) + .connectionPortalVersion(connectionPortalVersion) + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling AuthenticationApi#loginSnapTradeUser"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **userId** | **String**| | | +| **userSecret** | **String**| | | +| **snapTradeLoginUserRequestBody** | [**SnapTradeLoginUserRequestBody**](SnapTradeLoginUserRequestBody.md)| | [optional] | + +### Return type + +**Object** + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Login successful. Redirect user to provided URI in response | - | +| **500** | Unexpected Error | - | + + +# **registerSnapTradeUser** +> UserIDandSecret registerSnapTradeUser(snapTradeRegisterUserRequestBody).execute(); + +Create SnapTrade user + +Registers a new SnapTrade user under your ClientID. A user secret will be automatically generated for you and must be properly stored in your database. Most SnapTrade operations require a user ID and user secret to be passed as a parameter. + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.AuthenticationApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + String userId = "userId_example"; // SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable. + try { + UserIDandSecret result = client + .authentication + .registerSnapTradeUser() + .userId(userId) + .execute(); + System.out.println(result); + System.out.println(result.getUserId()); + System.out.println(result.getUserSecret()); + } catch (ApiException e) { + System.err.println("Exception when calling AuthenticationApi#registerSnapTradeUser"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse response = client + .authentication + .registerSnapTradeUser() + .userId(userId) + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling AuthenticationApi#registerSnapTradeUser"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **snapTradeRegisterUserRequestBody** | [**SnapTradeRegisterUserRequestBody**](SnapTradeRegisterUserRequestBody.md)| | | + +### Return type + +[**UserIDandSecret**](UserIDandSecret.md) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successfully registered user | - | + + +# **resetSnapTradeUserSecret** +> UserIDandSecret resetSnapTradeUserSecret(userIDandSecret).execute(); + +Obtain a new user secret for a user + +This API is used to rotate the secret for a SnapTrade user. You might use this if a userSecret is compromised. Please note that if you call this endpoint and fail to save the new secret, you'll no longer be able to access any data for this user, and your only option will be to delete and recreate the user, then ask them to reconnect. + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.AuthenticationApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + String userId = "userId_example"; // SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable. + String userSecret = "userSecret_example"; // SnapTrade User Secret randomly generated by SnapTrade. This is privileged information and if compromised, should be rotated via the SnapTrade API. + try { + UserIDandSecret result = client + .authentication + .resetSnapTradeUserSecret() + .userId(userId) + .userSecret(userSecret) + .execute(); + System.out.println(result); + System.out.println(result.getUserId()); + System.out.println(result.getUserSecret()); + } catch (ApiException e) { + System.err.println("Exception when calling AuthenticationApi#resetSnapTradeUserSecret"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse response = client + .authentication + .resetSnapTradeUserSecret() + .userId(userId) + .userSecret(userSecret) + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling AuthenticationApi#resetSnapTradeUserSecret"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **userIDandSecret** | [**UserIDandSecret**](UserIDandSecret.md)| | | + +### Return type + +[**UserIDandSecret**](UserIDandSecret.md) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | New user secret is generated | - | + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/Balance.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/Balance.md new file mode 100644 index 0000000000..f262cc1e09 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/Balance.md @@ -0,0 +1,16 @@ + + +# Balance + +Holds balance information for a single currency in an account. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**currency** | [**Currency**](Currency.md) | | [optional] | +|**cash** | **Double** | The amount of available cash in the account denominated in the currency of the `currency` field. | [optional] | +|**buyingPower** | **Double** | Buying power only applies to margin accounts. For non-margin accounts, buying power should be the same as cash. Please note that this field is not always available for all brokerages. | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/Brokerage.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/Brokerage.md new file mode 100644 index 0000000000..0c520508aa --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/Brokerage.md @@ -0,0 +1,32 @@ + + +# Brokerage + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **UUID** | | [optional] | +|**name** | **String** | Full name of the brokerage. | [optional] | +|**displayName** | **String** | A display-friendly name of the brokerage. | [optional] | +|**description** | **String** | | [optional] | +|**awsS3LogoUrl** | **String** | | [optional] | +|**awsS3SquareLogoUrl** | **String** | | [optional] | +|**openUrl** | **String** | | [optional] | +|**slug** | **String** | A unique identifier for that brokerage. It is usually the name of the brokerage in capital letters and will never change. | [optional] | +|**url** | **String** | | [optional] | +|**enabled** | **Boolean** | | [optional] | +|**maintenanceMode** | **Boolean** | | [optional] | +|**allowsFractionalUnits** | **Boolean** | | [optional] | +|**allowsTrading** | **Boolean** | | [optional] | +|**hasReporting** | **Boolean** | | [optional] | +|**isRealTimeConnection** | **Boolean** | | [optional] | +|**allowsTradingThroughSnaptradeApi** | **Boolean** | | [optional] | +|**isScrapingIntegration** | **Boolean** | | [optional] | +|**defaultCurrency** | **UUID** | | [optional] | +|**brokerageType** | [**BrokerageType**](BrokerageType.md) | | [optional] | +|**exchanges** | **List<Object>** | List of exchange ID supported by brokerage | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/BrokerageAuthorization.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/BrokerageAuthorization.md new file mode 100644 index 0000000000..82ba1db227 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/BrokerageAuthorization.md @@ -0,0 +1,21 @@ + + +# BrokerageAuthorization + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **UUID** | | [optional] | +|**createdDate** | **String** | Time | [optional] | +|**updatedDate** | **String** | Time | [optional] | +|**brokerage** | [**Brokerage**](Brokerage.md) | | [optional] | +|**name** | **String** | Connection Name | [optional] | +|**type** | **String** | | [optional] | +|**disabled** | **Boolean** | | [optional] | +|**disabledDate** | **String** | Disabled date | [optional] | +|**meta** | **Map<String, Object>** | Additional data about brokerage authorization | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/BrokerageAuthorizationDisabledConfirmation.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/BrokerageAuthorizationDisabledConfirmation.md new file mode 100644 index 0000000000..fe4b5e1f78 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/BrokerageAuthorizationDisabledConfirmation.md @@ -0,0 +1,13 @@ + + +# BrokerageAuthorizationDisabledConfirmation + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**detail** | **String** | Connection disabled confirmation | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/BrokerageAuthorizationRefreshConfirmation.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/BrokerageAuthorizationRefreshConfirmation.md new file mode 100644 index 0000000000..46d444643b --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/BrokerageAuthorizationRefreshConfirmation.md @@ -0,0 +1,13 @@ + + +# BrokerageAuthorizationRefreshConfirmation + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**detail** | **String** | Refresh confirmation details | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/BrokerageAuthorizationType.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/BrokerageAuthorizationType.md new file mode 100644 index 0000000000..ce2db8ea0e --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/BrokerageAuthorizationType.md @@ -0,0 +1,22 @@ + + +# BrokerageAuthorizationType + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**type** | [**TypeEnum**](#TypeEnum) | | [optional] | + + + +## Enum: TypeEnum + +| Name | Value | +|---- | -----| +| READ | "read" | +| TRADE | "trade" | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/BrokerageAuthorizationTypeReadOnly.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/BrokerageAuthorizationTypeReadOnly.md new file mode 100644 index 0000000000..88af18553a --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/BrokerageAuthorizationTypeReadOnly.md @@ -0,0 +1,36 @@ + + +# BrokerageAuthorizationTypeReadOnly + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **UUID** | | [optional] | +|**type** | [**TypeEnum**](#TypeEnum) | | [optional] | +|**authType** | [**AuthTypeEnum**](#AuthTypeEnum) | | [optional] | +|**brokerage** | [**BrokerageAuthorizationTypeReadOnlyBrokerage**](BrokerageAuthorizationTypeReadOnlyBrokerage.md) | | [optional] | + + + +## Enum: TypeEnum + +| Name | Value | +|---- | -----| +| READ | "read" | +| TRADE | "trade" | + + + +## Enum: AuthTypeEnum + +| Name | Value | +|---- | -----| +| OAUTH | "OAUTH" | +| SCRAPE | "SCRAPE" | +| UNOFFICIAL_API | "UNOFFICIAL_API" | +| TOKEN | "TOKEN" | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/BrokerageAuthorizationTypeReadOnlyBrokerage.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/BrokerageAuthorizationTypeReadOnlyBrokerage.md new file mode 100644 index 0000000000..fd3b1987e0 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/BrokerageAuthorizationTypeReadOnlyBrokerage.md @@ -0,0 +1,15 @@ + + +# BrokerageAuthorizationTypeReadOnlyBrokerage + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **UUID** | | [optional] | +|**name** | **String** | Full name of the brokerage. | [optional] | +|**slug** | **String** | A unique identifier for that brokerage. It is usually the name of the brokerage in capital letters and will never change. | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/BrokerageSymbol.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/BrokerageSymbol.md new file mode 100644 index 0000000000..bfd46ee462 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/BrokerageSymbol.md @@ -0,0 +1,19 @@ + + +# BrokerageSymbol + +Brokerage symbol + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **UUID** | | [optional] | +|**symbol** | [**UniversalSymbolNullable**](UniversalSymbolNullable.md) | | [optional] | +|**brokerageAuthorization** | [**BrokerageAuthorization**](BrokerageAuthorization.md) | | [optional] | +|**description** | **String** | | [optional] | +|**allowsFractionalUnits** | **Boolean** | | [optional] | +|**optionSymbol** | [**OptionsSymbolNullable**](OptionsSymbolNullable.md) | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/BrokerageType.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/BrokerageType.md new file mode 100644 index 0000000000..8520d91ae8 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/BrokerageType.md @@ -0,0 +1,15 @@ + + +# BrokerageType + +Type of brokerage + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **UUID** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/CalculatedTrade.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/CalculatedTrade.md new file mode 100644 index 0000000000..e181f558a4 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/CalculatedTrade.md @@ -0,0 +1,15 @@ + + +# CalculatedTrade + +Array of trades to make to rebalance portfolio + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **UUID** | | [optional] | +|**trades** | [**List<Trade>**](Trade.md) | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/CashRestriction.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/CashRestriction.md new file mode 100644 index 0000000000..3386ebccb1 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/CashRestriction.md @@ -0,0 +1,27 @@ + + +# CashRestriction + +Cash restriction rules that apply to this account when undergoing portfolio rebalance calculations. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **UUID** | | [optional] | +|**account** | **UUID** | | [optional] | +|**currency** | **UUID** | | [optional] | +|**type** | [**TypeEnum**](#TypeEnum) | | [optional] | +|**amount** | **Double** | | [optional] | + + + +## Enum: TypeEnum + +| Name | Value | +|---- | -----| +| ALLOCATE_MAX | "ALLOCATE_MAX" | +| RETAIN_MIN | "RETAIN_MIN" | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ConnectionsApi.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ConnectionsApi.md new file mode 100644 index 0000000000..ac59b7991d --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ConnectionsApi.md @@ -0,0 +1,603 @@ +# ConnectionsApi + +All URIs are relative to *https://api.snaptrade.com/api/v1* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**detailBrokerageAuthorization**](ConnectionsApi.md#detailBrokerageAuthorization) | **GET** /authorizations/{authorizationId} | Get brokerage authorization details | +| [**disableBrokerageAuthorization**](ConnectionsApi.md#disableBrokerageAuthorization) | **POST** /authorizations/{authorizationId}/disable | Manually disable a connection for testing | +| [**listBrokerageAuthorizations**](ConnectionsApi.md#listBrokerageAuthorizations) | **GET** /authorizations | List all brokerage authorizations for the User | +| [**refreshBrokerageAuthorization**](ConnectionsApi.md#refreshBrokerageAuthorization) | **POST** /authorizations/{authorizationId}/refresh | Refresh holdings for a connection | +| [**removeBrokerageAuthorization**](ConnectionsApi.md#removeBrokerageAuthorization) | **DELETE** /authorizations/{authorizationId} | Delete brokerage authorization | +| [**sessionEvents**](ConnectionsApi.md#sessionEvents) | **GET** /sessionEvents | Get all session events for a user | + + + +# **detailBrokerageAuthorization** +> BrokerageAuthorization detailBrokerageAuthorization(authorizationId, userId, userSecret).execute(); + +Get brokerage authorization details + +Returns a single brokerage authorization object for the specified ID. + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.ConnectionsApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + UUID authorizationId = UUID.randomUUID(); // The ID of a brokerage authorization object. + String userId = "userId_example"; + String userSecret = "userSecret_example"; + try { + BrokerageAuthorization result = client + .connections + .detailBrokerageAuthorization(authorizationId, userId, userSecret) + .execute(); + System.out.println(result); + System.out.println(result.getId()); + System.out.println(result.getCreatedDate()); + System.out.println(result.getUpdatedDate()); + System.out.println(result.getBrokerage()); + System.out.println(result.getName()); + System.out.println(result.getType()); + System.out.println(result.getDisabled()); + System.out.println(result.getDisabledDate()); + System.out.println(result.getMeta()); + } catch (ApiException e) { + System.err.println("Exception when calling ConnectionsApi#detailBrokerageAuthorization"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse response = client + .connections + .detailBrokerageAuthorization(authorizationId, userId, userSecret) + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling ConnectionsApi#detailBrokerageAuthorization"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **authorizationId** | **UUID**| The ID of a brokerage authorization object. | | +| **userId** | **String**| | | +| **userSecret** | **String**| | | + +### Return type + +[**BrokerageAuthorization**](BrokerageAuthorization.md) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Authorization object for the authenticated user. | - | +| **0** | Unexpected error. | - | + + +# **disableBrokerageAuthorization** +> BrokerageAuthorizationDisabledConfirmation disableBrokerageAuthorization(authorizationId, userId, userSecret).execute(); + +Manually disable a connection for testing + +Manually disable a connection. This should only be used for testing a reconnect flow, and never used on production connections. Will trigger a disconnect as if it happened naturally, and send a CONNECTION_BROKEN webhook for the connection. Please contact us in order to use this endpoint as it is disabled by default. + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.ConnectionsApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + UUID authorizationId = UUID.randomUUID(); // The ID of a brokerage authorization object. + String userId = "userId_example"; + String userSecret = "userSecret_example"; + try { + BrokerageAuthorizationDisabledConfirmation result = client + .connections + .disableBrokerageAuthorization(authorizationId, userId, userSecret) + .execute(); + System.out.println(result); + System.out.println(result.getDetail()); + } catch (ApiException e) { + System.err.println("Exception when calling ConnectionsApi#disableBrokerageAuthorization"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse response = client + .connections + .disableBrokerageAuthorization(authorizationId, userId, userSecret) + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling ConnectionsApi#disableBrokerageAuthorization"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **authorizationId** | **UUID**| The ID of a brokerage authorization object. | | +| **userId** | **String**| | | +| **userSecret** | **String**| | | + +### Return type + +[**BrokerageAuthorizationDisabledConfirmation**](BrokerageAuthorizationDisabledConfirmation.md) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Confirmation that the connection has been disabled | - | + + +# **listBrokerageAuthorizations** +> List<BrokerageAuthorization> listBrokerageAuthorizations(userId, userSecret).execute(); + +List all brokerage authorizations for the User + +Returns a list of Brokerage Authorization objects for the user + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.ConnectionsApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + String userId = "userId_example"; + String userSecret = "userSecret_example"; + try { + List result = client + .connections + .listBrokerageAuthorizations(userId, userSecret) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ConnectionsApi#listBrokerageAuthorizations"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse> response = client + .connections + .listBrokerageAuthorizations(userId, userSecret) + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling ConnectionsApi#listBrokerageAuthorizations"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **userId** | **String**| | | +| **userSecret** | **String**| | | + +### Return type + +[**List<BrokerageAuthorization>**](BrokerageAuthorization.md) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | A list of all Authorization objects for the authenticated user. | - | +| **0** | Unexpected error. | - | + + +# **refreshBrokerageAuthorization** +> BrokerageAuthorizationRefreshConfirmation refreshBrokerageAuthorization(authorizationId, userId, userSecret).execute(); + +Refresh holdings for a connection + +Trigger a holdings update for all accounts under this authorization. Updates will be queued asynchronously. ACCOUNT_HOLDINGS_UPDATED webhook will be sent once the sync completes. Please contact support for access as this endpoint is not enabled by default + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.ConnectionsApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + UUID authorizationId = UUID.randomUUID(); // The ID of a brokerage authorization object. + String userId = "userId_example"; + String userSecret = "userSecret_example"; + try { + BrokerageAuthorizationRefreshConfirmation result = client + .connections + .refreshBrokerageAuthorization(authorizationId, userId, userSecret) + .execute(); + System.out.println(result); + System.out.println(result.getDetail()); + } catch (ApiException e) { + System.err.println("Exception when calling ConnectionsApi#refreshBrokerageAuthorization"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse response = client + .connections + .refreshBrokerageAuthorization(authorizationId, userId, userSecret) + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling ConnectionsApi#refreshBrokerageAuthorization"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **authorizationId** | **UUID**| The ID of a brokerage authorization object. | | +| **userId** | **String**| | | +| **userSecret** | **String**| | | + +### Return type + +[**BrokerageAuthorizationRefreshConfirmation**](BrokerageAuthorizationRefreshConfirmation.md) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Confirmation that the syncs have been scheduled | - | + + +# **removeBrokerageAuthorization** +> removeBrokerageAuthorization(authorizationId, userId, userSecret).execute(); + +Delete brokerage authorization + +Deletes a specified brokerage authorization given by the ID. + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.ConnectionsApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + UUID authorizationId = UUID.randomUUID(); // The ID of the Authorization to delete. + String userId = "userId_example"; + String userSecret = "userSecret_example"; + try { + client + .connections + .removeBrokerageAuthorization(authorizationId, userId, userSecret) + .execute(); + } catch (ApiException e) { + System.err.println("Exception when calling ConnectionsApi#removeBrokerageAuthorization"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + client + .connections + .removeBrokerageAuthorization(authorizationId, userId, userSecret) + .executeWithHttpInfo(); + } catch (ApiException e) { + System.err.println("Exception when calling ConnectionsApi#removeBrokerageAuthorization"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **authorizationId** | **UUID**| The ID of the Authorization to delete. | | +| **userId** | **String**| | | +| **userSecret** | **String**| | | + +### Return type + +null (empty response body) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **204** | Brokerage authorization object has been successfully deleted | - | +| **400** | The specified authorizationId is invalid (not a UUID string). | - | +| **404** | The specified authorizationId was not found. | - | +| **0** | Unexpected error. | - | + + +# **sessionEvents** +> List<SessionEvent> sessionEvents(partnerClientId).userId(userId).sessionId(sessionId).execute(); + +Get all session events for a user + +Returns a list of session events associated with a user. + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.ConnectionsApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + String partnerClientId = "partnerClientId_example"; + String userId = "userId_example"; // Optional comma seperated list of user IDs used to filter the request on specific users + String sessionId = "sessionId_example"; // Optional comma seperated list of session IDs used to filter the request on specific users + try { + List result = client + .connections + .sessionEvents(partnerClientId) + .userId(userId) + .sessionId(sessionId) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ConnectionsApi#sessionEvents"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse> response = client + .connections + .sessionEvents(partnerClientId) + .userId(userId) + .sessionId(sessionId) + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling ConnectionsApi#sessionEvents"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **partnerClientId** | **String**| | | +| **userId** | **String**| Optional comma seperated list of user IDs used to filter the request on specific users | [optional] | +| **sessionId** | **String**| Optional comma seperated list of session IDs used to filter the request on specific users | [optional] | + +### Return type + +[**List<SessionEvent>**](SessionEvent.md) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | A list of all Session Events for the Partner. | - | +| **0** | Unexpected error. | - | + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/Currency.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/Currency.md new file mode 100644 index 0000000000..08bfc39815 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/Currency.md @@ -0,0 +1,16 @@ + + +# Currency + +Describes a currency object. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **UUID** | Unique identifier for the currency. This is the UUID used to reference the currency in SnapTrade. | [optional] | +|**code** | **String** | The ISO-4217 currency code for the currency. | [optional] | +|**name** | **String** | A human-friendly name of the currency. | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/CurrencyNullable.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/CurrencyNullable.md new file mode 100644 index 0000000000..1261d703fc --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/CurrencyNullable.md @@ -0,0 +1,16 @@ + + +# CurrencyNullable + +Describes a currency object. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **UUID** | Unique identifier for the currency. This is the UUID used to reference the currency in SnapTrade. | [optional] | +|**code** | **String** | The ISO-4217 currency code for the currency. | [optional] | +|**name** | **String** | A human-friendly name of the currency. | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/DeleteUserResponse.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/DeleteUserResponse.md new file mode 100644 index 0000000000..ed9a1b6f8c --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/DeleteUserResponse.md @@ -0,0 +1,15 @@ + + +# DeleteUserResponse + +Response when delete user is successful + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **String** | Delete status | [optional] | +|**userId** | **String** | SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable. | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/DividendAtDate.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/DividendAtDate.md new file mode 100644 index 0000000000..a77d7b9155 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/DividendAtDate.md @@ -0,0 +1,15 @@ + + +# DividendAtDate + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**symbol** | **String** | The ticker of the symbol that the dividend came from | [optional] | +|**amount** | **Double** | The amount received from the dividend | [optional] | +|**currency** | **String** | The currency of the amount | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/EncryptedResponse.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/EncryptedResponse.md new file mode 100644 index 0000000000..614ef62995 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/EncryptedResponse.md @@ -0,0 +1,15 @@ + + +# EncryptedResponse + +This response consists of 2 different components that must be decrypted to obtain the decrypted message * Decrypting the encryptedSharedKey The encrypted shared key is a shared key that was randomly generated by SnapTrade and encrypted using the users SSH public key provided when registering the user It is needed to decrypt the message in step 2. To decrypt the shared key, the user should have access to their SSH private key stored locally in their device An example Python code on how to decrypt the shared key is shown below ``` def decrypt_rsa_message(self, encrypted_message): from Crypto.Cipher import PKCS1_OAEP from Crypto.PublicKey import RSA from base64 import b64decode f = open('private.pem', 'r') private_key = RSA.import_key(f.read()) cipher = PKCS1_OAEP.new(private_key) return cipher.decrypt(b64decode(encrypted_message.encode())).decode() ``` * Decrypting the encryptedMessageData The data meant to be returned by an endpoint can be obtained by decrypting the encrypted message An encrypted message is a message that is encrypted using AES - MODE OCB with the shared key obtained in step one An example code to decrypt the encrypted message is shown below ``` def decrypt_aes_message(self, shared_key, encrypted_message): from Crypto.Cipher import AES from base64 import b64decode encrypted_msg = b64decode(encrypted_message[\"encryptedMessage\"].encode()) tag = b64decode(encrypted_message[\"tag\"].encode()) nonce = b64decode(encrypted_message[\"nonce\"].encode()) cipher = AES.new(shared_key.encode(), AES.MODE_OCB, nonce=nonce) return cipher.decrypt_and_verify(encrypted_msg, tag).decode() ``` + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**encryptedSharedKey** | **String** | | [optional] | +|**encryptedMessageData** | [**EncryptedResponseEncryptedMessageData**](EncryptedResponseEncryptedMessageData.md) | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/EncryptedResponseEncryptedMessageData.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/EncryptedResponseEncryptedMessageData.md new file mode 100644 index 0000000000..01c7d571be --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/EncryptedResponseEncryptedMessageData.md @@ -0,0 +1,15 @@ + + +# EncryptedResponseEncryptedMessageData + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**encryptedMessage** | **String** | | [optional] | +|**tag** | **String** | | [optional] | +|**nonce** | **String** | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/Exchange.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/Exchange.md new file mode 100644 index 0000000000..080bd968f4 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/Exchange.md @@ -0,0 +1,21 @@ + + +# Exchange + +Stock Exchange + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **UUID** | | [optional] | +|**code** | **String** | | [optional] | +|**micCode** | **String** | | [optional] | +|**name** | **String** | | [optional] | +|**timezone** | **String** | | [optional] | +|**startTime** | **String** | | [optional] | +|**closeTime** | **String** | | [optional] | +|**suffix** | **String** | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ExchangeRatePairs.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ExchangeRatePairs.md new file mode 100644 index 0000000000..4ff351e94c --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ExchangeRatePairs.md @@ -0,0 +1,16 @@ + + +# ExchangeRatePairs + +The exchange rate of a pair of currencies + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**src** | [**Currency**](Currency.md) | | [optional] | +|**dst** | [**Currency**](Currency.md) | | [optional] | +|**exchangeRate** | **Double** | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ExcludedAsset.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ExcludedAsset.md new file mode 100644 index 0000000000..c7a3fb711d --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ExcludedAsset.md @@ -0,0 +1,14 @@ + + +# ExcludedAsset + +An excluded asset in a portfolio group + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**symbol** | [**UniversalSymbol**](UniversalSymbol.md) | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/FigiInstrument.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/FigiInstrument.md new file mode 100644 index 0000000000..fcd64b65d2 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/FigiInstrument.md @@ -0,0 +1,15 @@ + + +# FigiInstrument + +Open FIGI Identifiers + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**figiCode** | **String** | | [optional] | +|**figiShareClass** | **String** | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/FigiInstrumentNullable.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/FigiInstrumentNullable.md new file mode 100644 index 0000000000..ddafb8c831 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/FigiInstrumentNullable.md @@ -0,0 +1,15 @@ + + +# FigiInstrumentNullable + +Open FIGI Identifiers + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**figiCode** | **String** | | [optional] | +|**figiShareClass** | **String** | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/HoldingsStatus.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/HoldingsStatus.md new file mode 100644 index 0000000000..4b0c33e646 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/HoldingsStatus.md @@ -0,0 +1,15 @@ + + +# HoldingsStatus + +Status of account holdings sync + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**initialSyncCompleted** | **Boolean** | | [optional] | +|**lastSuccessfulSync** | **String** | Date in ISO 8601 format or null (YYYY-MM-DD HH:MM:SS.mmmmmmTZ) | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/JWT.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/JWT.md new file mode 100644 index 0000000000..3168289cfe --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/JWT.md @@ -0,0 +1,14 @@ + + +# JWT + +JWT Token. Used to acess resources in private endpoints available only through the Passiv app + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**token** | **String** | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/LoginRedirectURI.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/LoginRedirectURI.md new file mode 100644 index 0000000000..bfd15f2882 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/LoginRedirectURI.md @@ -0,0 +1,15 @@ + + +# LoginRedirectURI + +Redirect uri upon successful login + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**redirectURI** | **Object** | | [optional] | +|**sessionId** | **String** | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ManualTrade.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ManualTrade.md new file mode 100644 index 0000000000..4aae0e355d --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ManualTrade.md @@ -0,0 +1,21 @@ + + +# ManualTrade + +A manual trade object + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **UUID** | | [optional] | +|**account** | **String** | | [optional] | +|**orderType** | **OrderTypeStrict** | | [optional] | +|**timeInForce** | **String** | Trade time in force examples: * FOK - Fill Or Kill * Day - Day * GTC - Good Til Canceled * GTD - Good Til Date | [optional] | +|**symbol** | [**ManualTradeSymbol**](ManualTradeSymbol.md) | | [optional] | +|**action** | **ActionStrict** | | [optional] | +|**units** | **Double** | Trade Units. Cannot work with notional value. | [optional] | +|**price** | **Double** | Trade Price if limit or stop limit order | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ManualTradeAndImpact.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ManualTradeAndImpact.md new file mode 100644 index 0000000000..34f1ba3703 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ManualTradeAndImpact.md @@ -0,0 +1,16 @@ + + +# ManualTradeAndImpact + +Manual Trade and Impact object + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**trade** | [**ManualTrade**](ManualTrade.md) | | [optional] | +|**tradeImpacts** | [**List<ManualTrade>**](ManualTrade.md) | | [optional] | +|**combinedRemainingBalance** | [**ManualTradeBalance**](ManualTradeBalance.md) | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ManualTradeBalance.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ManualTradeBalance.md new file mode 100644 index 0000000000..1e06f41b56 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ManualTradeBalance.md @@ -0,0 +1,16 @@ + + +# ManualTradeBalance + +Balance + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**account** | [**Account**](Account.md) | | [optional] | +|**currency** | [**Currency**](Currency.md) | | [optional] | +|**cash** | **Double** | Cash | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ManualTradeForm.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ManualTradeForm.md new file mode 100644 index 0000000000..ff1ad4be3c --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ManualTradeForm.md @@ -0,0 +1,22 @@ + + +# ManualTradeForm + +Manual Trade Form + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**accountId** | **UUID** | | [optional] | +|**action** | **ActionStrict** | | [optional] | +|**orderType** | **OrderTypeStrict** | | [optional] | +|**price** | **Double** | Trade Price if limit or stop limit order | [optional] | +|**stop** | **Double** | Stop Price. If stop loss or stop limit order, the price to trigger the stop | [optional] | +|**timeInForce** | **TimeInForceStrict** | | [optional] | +|**units** | **Double** | Trade Units. Cannot work with notional value. | [optional] | +|**universalSymbolId** | **UUID** | | [optional] | +|**notionalValue** | **Object** | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ManualTradeSymbol.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ManualTradeSymbol.md new file mode 100644 index 0000000000..d1ba5d8069 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ManualTradeSymbol.md @@ -0,0 +1,19 @@ + + +# ManualTradeSymbol + +Manual trade symbol object + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**brokerageSymbolId** | **UUID** | | [optional] | +|**universalSymbolId** | **UUID** | | [optional] | +|**currency** | [**Currency**](Currency.md) | | [optional] | +|**localId** | **String** | | [optional] | +|**description** | **String** | | [optional] | +|**symbol** | **String** | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ModelAssetClass.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ModelAssetClass.md new file mode 100644 index 0000000000..ed5faf99d1 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ModelAssetClass.md @@ -0,0 +1,14 @@ + + +# ModelAssetClass + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **UUID** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ModelAssetClassDetails.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ModelAssetClassDetails.md new file mode 100644 index 0000000000..5dd80f6007 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ModelAssetClassDetails.md @@ -0,0 +1,14 @@ + + +# ModelAssetClassDetails + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**modelAssetClass** | [**ModelAssetClass**](ModelAssetClass.md) | | [optional] | +|**modelAssetClassTarget** | [**List<ModelAssetClassTarget>**](ModelAssetClassTarget.md) | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ModelAssetClassTarget.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ModelAssetClassTarget.md new file mode 100644 index 0000000000..525bfc5276 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ModelAssetClassTarget.md @@ -0,0 +1,13 @@ + + +# ModelAssetClassTarget + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**symbol** | [**UniversalSymbol**](UniversalSymbol.md) | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ModelPortfolio.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ModelPortfolio.md new file mode 100644 index 0000000000..b6ee6709e7 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ModelPortfolio.md @@ -0,0 +1,25 @@ + + +# ModelPortfolio + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **UUID** | | [optional] | +|**name** | **String** | | [optional] | +|**modelType** | [**ModelTypeEnum**](#ModelTypeEnum) | Enum definitions -> [-1: Unassigned, 0: Security Model Portfolio, 1: Asset Class Portfolio] | [optional] | + + + +## Enum: ModelTypeEnum + +| Name | Value | +|---- | -----| +| NUMBER_MINUS_1 | -1 | +| NUMBER_0 | 0 | +| NUMBER_1 | 1 | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ModelPortfolioAssetClass.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ModelPortfolioAssetClass.md new file mode 100644 index 0000000000..8748b01bbb --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ModelPortfolioAssetClass.md @@ -0,0 +1,14 @@ + + +# ModelPortfolioAssetClass + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**modelAssetClass** | [**ModelAssetClass**](ModelAssetClass.md) | | [optional] | +|**percent** | **Integer** | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ModelPortfolioDetails.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ModelPortfolioDetails.md new file mode 100644 index 0000000000..23ce3eaf07 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ModelPortfolioDetails.md @@ -0,0 +1,15 @@ + + +# ModelPortfolioDetails + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**modelPortfolio** | [**ModelPortfolio**](ModelPortfolio.md) | | [optional] | +|**modelPortfolioSecurity** | [**List<ModelPortfolioSecurity>**](ModelPortfolioSecurity.md) | | [optional] | +|**modelPortfolioAssetClass** | [**List<ModelPortfolioAssetClass>**](ModelPortfolioAssetClass.md) | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ModelPortfolioSecurity.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ModelPortfolioSecurity.md new file mode 100644 index 0000000000..193e385ec9 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ModelPortfolioSecurity.md @@ -0,0 +1,14 @@ + + +# ModelPortfolioSecurity + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**symbol** | [**UniversalSymbol**](UniversalSymbol.md) | | [optional] | +|**percent** | **Integer** | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/MonthlyDividends.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/MonthlyDividends.md new file mode 100644 index 0000000000..9743dd0165 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/MonthlyDividends.md @@ -0,0 +1,14 @@ + + +# MonthlyDividends + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**date** | **LocalDate** | Date used to specify timeframe for a reporting call (in YYYY-MM-DD format) | [optional] | +|**dividends** | [**List<DividendAtDate>**](DividendAtDate.md) | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/NetContributions.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/NetContributions.md new file mode 100644 index 0000000000..6a4de04d55 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/NetContributions.md @@ -0,0 +1,15 @@ + + +# NetContributions + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**date** | **LocalDate** | Date used to specify timeframe for a reporting call (in YYYY-MM-DD format) | [optional] | +|**contributions** | **Double** | | [optional] | +|**currency** | **String** | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/NetDividend.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/NetDividend.md new file mode 100644 index 0000000000..c2369e8c42 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/NetDividend.md @@ -0,0 +1,16 @@ + + +# NetDividend + +Object representing total dividends received during a timeframe + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**symbol** | [**UniversalSymbol**](UniversalSymbol.md) | | [optional] | +|**amount** | **Double** | | [optional] | +|**currency** | **String** | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OptionBrokerageSymbol.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OptionBrokerageSymbol.md new file mode 100644 index 0000000000..1f1700dacb --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OptionBrokerageSymbol.md @@ -0,0 +1,16 @@ + + +# OptionBrokerageSymbol + +Option Brokerage symbol + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **UUID** | | [optional] | +|**description** | **String** | | [optional] | +|**optionSymbol** | [**OptionsSymbol**](OptionsSymbol.md) | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OptionChainInner.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OptionChainInner.md new file mode 100644 index 0000000000..6c72023c53 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OptionChainInner.md @@ -0,0 +1,17 @@ + + +# OptionChainInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**expiryDate** | **String** | | [optional] | +|**description** | **String** | | [optional] | +|**listingExchange** | **String** | | [optional] | +|**optionExerciseType** | **String** | | [optional] | +|**chainPerRoot** | [**List<OptionChainInnerChainPerRootInner>**](OptionChainInnerChainPerRootInner.md) | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OptionChainInnerChainPerRootInner.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OptionChainInnerChainPerRootInner.md new file mode 100644 index 0000000000..1fabdfc19a --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OptionChainInnerChainPerRootInner.md @@ -0,0 +1,15 @@ + + +# OptionChainInnerChainPerRootInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**optionRoot** | **String** | | [optional] | +|**chainPerStrikePrice** | [**List<OptionChainInnerChainPerRootInnerChainPerStrikePriceInner>**](OptionChainInnerChainPerRootInnerChainPerStrikePriceInner.md) | | [optional] | +|**multiplier** | **Integer** | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OptionChainInnerChainPerRootInnerChainPerStrikePriceInner.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OptionChainInnerChainPerRootInnerChainPerStrikePriceInner.md new file mode 100644 index 0000000000..3676a37bea --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OptionChainInnerChainPerRootInnerChainPerStrikePriceInner.md @@ -0,0 +1,15 @@ + + +# OptionChainInnerChainPerRootInnerChainPerStrikePriceInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**strikePrice** | **Integer** | | [optional] | +|**callSymbolId** | **Integer** | | [optional] | +|**putSymbolId** | **Integer** | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OptionLeg.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OptionLeg.md new file mode 100644 index 0000000000..feee973a32 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OptionLeg.md @@ -0,0 +1,27 @@ + + +# OptionLeg + +Option Leg + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**action** | [**ActionEnum**](#ActionEnum) | | [optional] | +|**optionSymbolId** | **String** | Obtained from calling options chain endpoint (option_id) | [optional] | +|**quantity** | **Double** | | [optional] | + + + +## Enum: ActionEnum + +| Name | Value | +|---- | -----| +| BUY_TO_OPEN | "BUY_TO_OPEN" | +| BUY_TO_CLOSE | "BUY_TO_CLOSE" | +| SELL_TO_OPEN | "SELL_TO_OPEN" | +| SELL_TO_CLOSE | "SELL_TO_CLOSE" | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OptionStrategy.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OptionStrategy.md new file mode 100644 index 0000000000..b20aaf10ef --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OptionStrategy.md @@ -0,0 +1,17 @@ + + +# OptionStrategy + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **UUID** | | [optional] | +|**underlyingSymbolId** | [**UniversalSymbol**](UniversalSymbol.md) | | [optional] | +|**strategyType** | **String** | | [optional] | +|**numberOfLegs** | **Double** | | [optional] | +|**legs** | [**List<OptionStrategyLegsInner>**](OptionStrategyLegsInner.md) | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OptionStrategyLegsInner.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OptionStrategyLegsInner.md new file mode 100644 index 0000000000..8a7fa88087 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OptionStrategyLegsInner.md @@ -0,0 +1,16 @@ + + +# OptionStrategyLegsInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**optionSymbolId** | **String** | | [optional] | +|**index** | **Double** | | [optional] | +|**action** | **String** | | [optional] | +|**quantity** | **Double** | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OptionsApi.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OptionsApi.md new file mode 100644 index 0000000000..45ce4d573a --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OptionsApi.md @@ -0,0 +1,532 @@ +# OptionsApi + +All URIs are relative to *https://api.snaptrade.com/api/v1* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**getOptionStrategy**](OptionsApi.md#getOptionStrategy) | **POST** /accounts/{accountId}/optionStrategy | Create options strategy | +| [**getOptionsChain**](OptionsApi.md#getOptionsChain) | **GET** /accounts/{accountId}/optionsChain | Get the options chain for a symbol | +| [**getOptionsStrategyQuote**](OptionsApi.md#getOptionsStrategyQuote) | **GET** /accounts/{accountId}/optionStrategy/{optionStrategyId} | Get options strategy quotes | +| [**listOptionHoldings**](OptionsApi.md#listOptionHoldings) | **GET** /accounts/{accountId}/options | Get account option holdings | +| [**placeOptionStrategy**](OptionsApi.md#placeOptionStrategy) | **POST** /accounts/{accountId}/optionStrategy/{optionStrategyId}/execute | Place an option strategy order | + + + +# **getOptionStrategy** +> StrategyQuotes getOptionStrategy(userId, userSecret, accountId, optionsGetOptionStrategyRequest).execute(); + +Create options strategy + +Creates an option strategy object that will be used to place an option strategy order. + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.OptionsApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + UUID underlyingSymbolId = UUID.randomUUID(); + List legs = Arrays.asList(); + String strategyType = "CUSTOM"; + String userId = "userId_example"; + String userSecret = "userSecret_example"; + UUID accountId = UUID.randomUUID(); // The ID of the account to create the option strategy object in. + try { + StrategyQuotes result = client + .options + .getOptionStrategy(underlyingSymbolId, legs, strategyType, userId, userSecret, accountId) + .execute(); + System.out.println(result); + System.out.println(result.getStrategy()); + System.out.println(result.getOpenPrice()); + System.out.println(result.getBidPrice()); + System.out.println(result.getAskPrice()); + System.out.println(result.getVolatility()); + System.out.println(result.getGreek()); + } catch (ApiException e) { + System.err.println("Exception when calling OptionsApi#getOptionStrategy"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse response = client + .options + .getOptionStrategy(underlyingSymbolId, legs, strategyType, userId, userSecret, accountId) + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling OptionsApi#getOptionStrategy"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **userId** | **String**| | | +| **userSecret** | **String**| | | +| **accountId** | **UUID**| The ID of the account to create the option strategy object in. | | +| **optionsGetOptionStrategyRequest** | [**OptionsGetOptionStrategyRequest**](OptionsGetOptionStrategyRequest.md)| | | + +### Return type + +[**StrategyQuotes**](StrategyQuotes.md) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Order Quotes | - | + + +# **getOptionsChain** +> List<OptionChainInner> getOptionsChain(userId, userSecret, accountId, symbol).execute(); + +Get the options chain for a symbol + +Returns the option chain for the specified symbol in the specified account. + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.OptionsApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + String userId = "userId_example"; + String userSecret = "userSecret_example"; + UUID accountId = UUID.randomUUID(); // The ID of the account to get the options chain from. + UUID symbol = UUID.randomUUID(); // Universal symbol ID if symbol + try { + List result = client + .options + .getOptionsChain(userId, userSecret, accountId, symbol) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling OptionsApi#getOptionsChain"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse> response = client + .options + .getOptionsChain(userId, userSecret, accountId, symbol) + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling OptionsApi#getOptionsChain"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **userId** | **String**| | | +| **userSecret** | **String**| | | +| **accountId** | **UUID**| The ID of the account to get the options chain from. | | +| **symbol** | **UUID**| Universal symbol ID if symbol | | + +### Return type + +[**List<OptionChainInner>**](OptionChainInner.md) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | List of all Options available for the brokerage symbol | - | + + +# **getOptionsStrategyQuote** +> StrategyQuotes getOptionsStrategyQuote(userId, userSecret, accountId, optionStrategyId).execute(); + +Get options strategy quotes + +Returns a Strategy Quotes object which has latest market data of the specified option strategy. + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.OptionsApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + String userId = "userId_example"; + String userSecret = "userSecret_example"; + UUID accountId = UUID.randomUUID(); // The ID of the account the strategy will be placed in. + UUID optionStrategyId = UUID.randomUUID(); // Option strategy id obtained from response when creating option strategy object + try { + StrategyQuotes result = client + .options + .getOptionsStrategyQuote(userId, userSecret, accountId, optionStrategyId) + .execute(); + System.out.println(result); + System.out.println(result.getStrategy()); + System.out.println(result.getOpenPrice()); + System.out.println(result.getBidPrice()); + System.out.println(result.getAskPrice()); + System.out.println(result.getVolatility()); + System.out.println(result.getGreek()); + } catch (ApiException e) { + System.err.println("Exception when calling OptionsApi#getOptionsStrategyQuote"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse response = client + .options + .getOptionsStrategyQuote(userId, userSecret, accountId, optionStrategyId) + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling OptionsApi#getOptionsStrategyQuote"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **userId** | **String**| | | +| **userSecret** | **String**| | | +| **accountId** | **UUID**| The ID of the account the strategy will be placed in. | | +| **optionStrategyId** | **UUID**| Option strategy id obtained from response when creating option strategy object | | + +### Return type + +[**StrategyQuotes**](StrategyQuotes.md) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Order Quotes | - | + + +# **listOptionHoldings** +> List<OptionsPosition> listOptionHoldings(userId, userSecret, accountId).execute(); + +Get account option holdings + +Returns a list of Options Positions. + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.OptionsApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + String userId = "userId_example"; + String userSecret = "userSecret_example"; + UUID accountId = UUID.randomUUID(); // The ID of the account to fetch options holdings for. + try { + List result = client + .options + .listOptionHoldings(userId, userSecret, accountId) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling OptionsApi#listOptionHoldings"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse> response = client + .options + .listOptionHoldings(userId, userSecret, accountId) + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling OptionsApi#listOptionHoldings"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **userId** | **String**| | | +| **userSecret** | **String**| | | +| **accountId** | **UUID**| The ID of the account to fetch options holdings for. | | + +### Return type + +[**List<OptionsPosition>**](OptionsPosition.md) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | The option holdings in the account | - | + + +# **placeOptionStrategy** +> StrategyOrderRecord placeOptionStrategy(userId, userSecret, accountId, optionStrategyId, optionsPlaceOptionStrategyRequest).execute(); + +Place an option strategy order + +Places the option strategy order and returns the order record received from the brokerage. + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.OptionsApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + OrderTypeStrict orderType = OrderTypeStrict.fromValue("Limit"); + TimeInForceStrict timeInForce = TimeInForceStrict.fromValue("FOK"); + String userId = "userId_example"; + String userSecret = "userSecret_example"; + UUID accountId = UUID.randomUUID(); // The ID of the account to execute the strategy in. + UUID optionStrategyId = UUID.randomUUID(); // Option strategy id obtained from response when creating option strategy object + Double price = 3.4D; // Trade Price if limit or stop limit order + try { + StrategyOrderRecord result = client + .options + .placeOptionStrategy(orderType, timeInForce, userId, userSecret, accountId, optionStrategyId) + .price(price) + .execute(); + System.out.println(result); + System.out.println(result.getStrategy()); + System.out.println(result.getStatus()); + System.out.println(result.getFilledQuantity()); + System.out.println(result.getOpenQuantity()); + System.out.println(result.getClosedQuantity()); + System.out.println(result.getOrderType()); + System.out.println(result.getTimeInForce()); + System.out.println(result.getLimitPrice()); + System.out.println(result.getExecutionPrice()); + System.out.println(result.getTimePlaced()); + System.out.println(result.getTimeUpdated()); + } catch (ApiException e) { + System.err.println("Exception when calling OptionsApi#placeOptionStrategy"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse response = client + .options + .placeOptionStrategy(orderType, timeInForce, userId, userSecret, accountId, optionStrategyId) + .price(price) + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling OptionsApi#placeOptionStrategy"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **userId** | **String**| | | +| **userSecret** | **String**| | | +| **accountId** | **UUID**| The ID of the account to execute the strategy in. | | +| **optionStrategyId** | **UUID**| Option strategy id obtained from response when creating option strategy object | | +| **optionsPlaceOptionStrategyRequest** | [**OptionsPlaceOptionStrategyRequest**](OptionsPlaceOptionStrategyRequest.md)| | | + +### Return type + +[**StrategyOrderRecord**](StrategyOrderRecord.md) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Status of strategy order placed | - | + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OptionsGetOptionStrategyRequest.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OptionsGetOptionStrategyRequest.md new file mode 100644 index 0000000000..f314847966 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OptionsGetOptionStrategyRequest.md @@ -0,0 +1,23 @@ + + +# OptionsGetOptionStrategyRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**underlyingSymbolId** | **UUID** | | | +|**legs** | [**List<OptionLeg>**](OptionLeg.md) | | | +|**strategyType** | [**StrategyTypeEnum**](#StrategyTypeEnum) | | | + + + +## Enum: StrategyTypeEnum + +| Name | Value | +|---- | -----| +| CUSTOM | "CUSTOM" | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OptionsPlaceOptionStrategyRequest.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OptionsPlaceOptionStrategyRequest.md new file mode 100644 index 0000000000..b12e10c0ee --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OptionsPlaceOptionStrategyRequest.md @@ -0,0 +1,15 @@ + + +# OptionsPlaceOptionStrategyRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**orderType** | **OrderTypeStrict** | | | +|**timeInForce** | **TimeInForceStrict** | | | +|**price** | **Double** | Trade Price if limit or stop limit order | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OptionsPosition.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OptionsPosition.md new file mode 100644 index 0000000000..dbc7a801e6 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OptionsPosition.md @@ -0,0 +1,18 @@ + + +# OptionsPosition + +Describes a single option position in an account. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**symbol** | [**OptionBrokerageSymbol**](OptionBrokerageSymbol.md) | | [optional] | +|**price** | **Double** | Last known market price for the option contract. The freshness of this price depends on the brokerage. Some brokerages provide real-time prices, while others provide delayed prices. It is recommended that you rely on your own third-party market data provider for most up to date prices. | [optional] | +|**units** | **Double** | The number of contracts for this option position. | [optional] | +|**currency** | [**CurrencyNullable**](CurrencyNullable.md) | | [optional] | +|**averagePurchasePrice** | **Double** | Cost basis _per contract_ of this option position. To get the cost basis _per share_, divide this value by the number of shares per contract (usually 100). | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OptionsSymbol.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OptionsSymbol.md new file mode 100644 index 0000000000..ccfde9f280 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OptionsSymbol.md @@ -0,0 +1,31 @@ + + +# OptionsSymbol + +Options Symbol + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **UUID** | | | +|**ticker** | **String** | | | +|**optionType** | [**OptionTypeEnum**](#OptionTypeEnum) | | | +|**strikePrice** | **Double** | | | +|**expirationDate** | **String** | | | +|**isMiniOption** | **Boolean** | | [optional] | +|**underlyingSymbol** | [**UnderlyingSymbol**](UnderlyingSymbol.md) | | | +|**localId** | **String** | | [optional] | +|**exchangeId** | **UUID** | | [optional] | + + + +## Enum: OptionTypeEnum + +| Name | Value | +|---- | -----| +| CALL | "CALL" | +| PUT | "PUT" | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OptionsSymbolNullable.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OptionsSymbolNullable.md new file mode 100644 index 0000000000..c358194cf7 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OptionsSymbolNullable.md @@ -0,0 +1,31 @@ + + +# OptionsSymbolNullable + +Options Symbol + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **UUID** | | | +|**ticker** | **String** | | | +|**optionType** | [**OptionTypeEnum**](#OptionTypeEnum) | | | +|**strikePrice** | **Double** | | | +|**expirationDate** | **String** | | | +|**isMiniOption** | **Boolean** | | [optional] | +|**underlyingSymbol** | [**UnderlyingSymbol**](UnderlyingSymbol.md) | | | +|**localId** | **String** | | [optional] | +|**exchangeId** | **UUID** | | [optional] | + + + +## Enum: OptionTypeEnum + +| Name | Value | +|---- | -----| +| CALL | "CALL" | +| PUT | "PUT" | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OrderTypeStrict.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OrderTypeStrict.md new file mode 100644 index 0000000000..d9fa96cb19 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/OrderTypeStrict.md @@ -0,0 +1,17 @@ + + +# OrderTypeStrict + +## Enum + + +* `LIMIT` (value: `"Limit"`) + +* `MARKET` (value: `"Market"`) + +* `STOPLIMIT` (value: `"StopLimit"`) + +* `STOPLOSS` (value: `"StopLoss"`) + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/PartnerData.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/PartnerData.md new file mode 100644 index 0000000000..176aaaa68e --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/PartnerData.md @@ -0,0 +1,25 @@ + + +# PartnerData + +SnapTrade Partner metadata + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**redirectUri** | **String** | URI to redirect user back to after user is done adding brokerage connections | [optional] | +|**allowedBrokerages** | [**List<Brokerage>**](Brokerage.md) | Brokerages that can be accessed by partners | [optional] | +|**name** | **String** | Name of Snaptrade Partner | [optional] | +|**slug** | **String** | Slug of Snaptrade Partner | [optional] | +|**logoUrl** | **String** | URL to partner's logo | [optional] | +|**pinRequired** | **Boolean** | Shows if pin is required by users to access connection page | [optional] | +|**canAccessTrades** | **Boolean** | Shows if users of Snaptrade partners can access trade endpoints | [optional] | +|**canAccessHoldings** | **Boolean** | Shows if Snaptrade partners can get user holdings data | [optional] | +|**canAccessAccountHistory** | **Boolean** | Shows if Snaptrade partners can get users account history data | [optional] | +|**canAccessReferenceData** | **Boolean** | Shows if Snaptrade partners can get users holdings data | [optional] | +|**canAccessPortfolioManagement** | **Boolean** | Shows if users Snaptrade partners can access portfolio group management features | [optional] | +|**canAccessOrders** | **Boolean** | Shows if Snaptrade partners can get users account order history | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/PastValue.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/PastValue.md new file mode 100644 index 0000000000..1cc00a7feb --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/PastValue.md @@ -0,0 +1,15 @@ + + +# PastValue + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**date** | **LocalDate** | Date used to specify timeframe for a reporting call (in YYYY-MM-DD format) | [optional] | +|**value** | **Double** | | [optional] | +|**currency** | **String** | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/PerformanceCustom.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/PerformanceCustom.md new file mode 100644 index 0000000000..2e69f6a784 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/PerformanceCustom.md @@ -0,0 +1,32 @@ + + +# PerformanceCustom + +Performance Custom Response Object + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**totalEquityTimeframe** | [**List<PastValue>**](PastValue.md) | | [optional] | +|**contributions** | [**NetContributions**](NetContributions.md) | | [optional] | +|**contributionTimeframe** | [**List<PastValue>**](PastValue.md) | | [optional] | +|**contributionTimeframeCumulative** | [**List<PastValue>**](PastValue.md) | | [optional] | +|**withdrawalTimeframe** | [**List<PastValue>**](PastValue.md) | | [optional] | +|**contributionStreak** | **Double** | Current streak of cosecutive months where contributions were made | [optional] | +|**contributionMonthsContributed** | **Double** | Number of months in the timeframe with contributions | [optional] | +|**contributionTotalMonths** | **Double** | Total months in timeframe | [optional] | +|**dividends** | [**List<NetDividend>**](NetDividend.md) | | [optional] | +|**dividendIncome** | **Double** | Total dividends received over the timeframe | [optional] | +|**monthlyDividends** | **Double** | Average dividends received per month over the timeframe | [optional] | +|**badTickers** | **List<String>** | list of tickers which may not be supported or may not have accurate price data | [optional] | +|**dividendTimeline** | [**List<MonthlyDividends>**](MonthlyDividends.md) | | [optional] | +|**commissions** | **Double** | commissions incurred during the timeframe | [optional] | +|**forexFees** | **Double** | forex fees incurred during the timeframe | [optional] | +|**fees** | **Double** | other fees incurred during the timeframe | [optional] | +|**rateOfReturn** | **Double** | The return rate over the timeframe. Annualized if timeframe is longer than 1 year | [optional] | +|**returnRateTimeframe** | [**List<SubPeriodReturnRate>**](SubPeriodReturnRate.md) | | [optional] | +|**detailedMode** | **Boolean** | Whether the user has detailed mode enabled (more frequent data points for totalEquity and contribution timeframes) | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/PortfolioGroup.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/PortfolioGroup.md new file mode 100644 index 0000000000..4ac813c0b5 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/PortfolioGroup.md @@ -0,0 +1,14 @@ + + +# PortfolioGroup + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **UUID** | | [optional] | +|**name** | **String** | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/PortfolioGroupInfo.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/PortfolioGroupInfo.md new file mode 100644 index 0000000000..6a137bf41c --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/PortfolioGroupInfo.md @@ -0,0 +1,24 @@ + + +# PortfolioGroupInfo + +Summary of all relevant information about a portfolio group. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**symbols** | [**List<UniversalSymbol>**](UniversalSymbol.md) | | [optional] | +|**quotableSymbols** | [**List<UniversalSymbol>**](UniversalSymbol.md) | | [optional] | +|**balances** | [**List<Balance>**](Balance.md) | | [optional] | +|**positions** | [**List<Position>**](Position.md) | | [optional] | +|**targetPositions** | [**List<TargetAsset>**](TargetAsset.md) | | [optional] | +|**idealPositions** | [**List<Position>**](Position.md) | | [optional] | +|**excludedPositions** | [**List<ExcludedAsset>**](ExcludedAsset.md) | | [optional] | +|**calculatedTrades** | [**List<CalculatedTrade>**](CalculatedTrade.md) | | [optional] | +|**brokerageAuthorizations** | [**List<BrokerageAuthorization>**](BrokerageAuthorization.md) | | [optional] | +|**accuracy** | **Double** | | [optional] | +|**settings** | [**PortfolioGroupSettings**](PortfolioGroupSettings.md) | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/PortfolioGroupPosition.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/PortfolioGroupPosition.md new file mode 100644 index 0000000000..81a1b0267a --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/PortfolioGroupPosition.md @@ -0,0 +1,16 @@ + + +# PortfolioGroupPosition + +Details of a security held + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**symbol** | [**UniversalSymbol**](UniversalSymbol.md) | | [optional] | +|**price** | **Double** | Last known market price for the symbol | [optional] | +|**units** | **Integer** | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/PortfolioGroupSettings.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/PortfolioGroupSettings.md new file mode 100644 index 0000000000..dfae150a8d --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/PortfolioGroupSettings.md @@ -0,0 +1,17 @@ + + +# PortfolioGroupSettings + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**buyOnly** | **Boolean** | | [optional] | +|**cashOptimizer** | **Boolean** | | [optional] | +|**notifyFrequency** | **String** | | [optional] | +|**driftThreshold** | **Double** | | [optional] | +|**preferredCurrency** | [**Currency**](Currency.md) | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/Position.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/Position.md new file mode 100644 index 0000000000..1c03070c8c --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/Position.md @@ -0,0 +1,19 @@ + + +# Position + +Describes a single stock/ETF/crypto/mutual fund position in an account. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**symbol** | [**PositionSymbol**](PositionSymbol.md) | | [optional] | +|**units** | **Double** | The number of shares of the position. This can be fractional or integer units. | [optional] | +|**price** | **Double** | Last known market price for the symbol. The freshness of this price depends on the brokerage. Some brokerages provide real-time prices, while others provide delayed prices. It is recommended that you rely on your own third-party market data provider for most up to date prices. | [optional] | +|**openPnl** | **Double** | The profit or loss on the position since it was opened. This is calculated as the difference between the current market value of the position and the total cost of the position. It is recommended to calculate this value using the average purchase price and the current market price yourself, instead of relying on this field. | [optional] | +|**fractionalUnits** | **Double** | Deprecated, use the `units` field for both fractional and integer units going forward | [optional] | +|**averagePurchasePrice** | **Double** | Cost basis _per share_ of this position. | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/PositionSymbol.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/PositionSymbol.md new file mode 100644 index 0000000000..285d2d6478 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/PositionSymbol.md @@ -0,0 +1,19 @@ + + +# PositionSymbol + +Symbol returned in position object + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **UUID** | | [optional] | +|**description** | **String** | | [optional] | +|**symbol** | [**UniversalSymbol**](UniversalSymbol.md) | | [optional] | +|**localId** | **String** | | [optional] | +|**isQuotable** | **Boolean** | | [optional] | +|**isTradable** | **Boolean** | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/RedirectTokenandPin.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/RedirectTokenandPin.md new file mode 100644 index 0000000000..e2124d7676 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/RedirectTokenandPin.md @@ -0,0 +1,15 @@ + + +# RedirectTokenandPin + +Response when register user is successful + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**token** | **String** | | [optional] | +|**pin** | **String** | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ReferenceDataApi.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ReferenceDataApi.md new file mode 100644 index 0000000000..c79e62a8c4 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ReferenceDataApi.md @@ -0,0 +1,1053 @@ +# ReferenceDataApi + +All URIs are relative to *https://api.snaptrade.com/api/v1* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**getCurrencyExchangeRatePair**](ReferenceDataApi.md#getCurrencyExchangeRatePair) | **GET** /currencies/rates/{currencyPair} | Get exchange rate of a currency pair | +| [**getPartnerInfo**](ReferenceDataApi.md#getPartnerInfo) | **GET** /snapTrade/partners | Get metadata related to Snaptrade partner | +| [**getSecurityTypes**](ReferenceDataApi.md#getSecurityTypes) | **GET** /securityTypes | List of all security types | +| [**getStockExchanges**](ReferenceDataApi.md#getStockExchanges) | **GET** /exchanges | Get exchanges | +| [**getSymbols**](ReferenceDataApi.md#getSymbols) | **POST** /symbols | Search for symbols | +| [**getSymbolsByTicker**](ReferenceDataApi.md#getSymbolsByTicker) | **GET** /symbols/{query} | Get details of a symbol | +| [**listAllBrokerageAuthorizationType**](ReferenceDataApi.md#listAllBrokerageAuthorizationType) | **GET** /brokerageAuthorizationTypes | Get all brokerage authorization types | +| [**listAllBrokerages**](ReferenceDataApi.md#listAllBrokerages) | **GET** /brokerages | Get brokerages | +| [**listAllCurrencies**](ReferenceDataApi.md#listAllCurrencies) | **GET** /currencies | Get currencies | +| [**listAllCurrenciesRates**](ReferenceDataApi.md#listAllCurrenciesRates) | **GET** /currencies/rates | Get currency exchange rates | +| [**symbolSearchUserAccount**](ReferenceDataApi.md#symbolSearchUserAccount) | **POST** /accounts/{accountId}/symbols | Search for symbols available in an account | + + + +# **getCurrencyExchangeRatePair** +> ExchangeRatePairs getCurrencyExchangeRatePair(currencyPair).execute(); + +Get exchange rate of a currency pair + +Returns an Exchange Rate Pair object for the specified Currency Pair. + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.ReferenceDataApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + String currencyPair = "currencyPair_example"; // A currency pair based on currency code for example, {CAD-USD} + try { + ExchangeRatePairs result = client + .referenceData + .getCurrencyExchangeRatePair(currencyPair) + .execute(); + System.out.println(result); + System.out.println(result.getSrc()); + System.out.println(result.getDst()); + System.out.println(result.getExchangeRate()); + } catch (ApiException e) { + System.err.println("Exception when calling ReferenceDataApi#getCurrencyExchangeRatePair"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse response = client + .referenceData + .getCurrencyExchangeRatePair(currencyPair) + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling ReferenceDataApi#getCurrencyExchangeRatePair"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **currencyPair** | **String**| A currency pair based on currency code for example, {CAD-USD} | | + +### Return type + +[**ExchangeRatePairs**](ExchangeRatePairs.md) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | A list of all exchange rates pairs for supported currencies | - | + + +# **getPartnerInfo** +> PartnerData getPartnerInfo().execute(); + +Get metadata related to Snaptrade partner + +Returns useful data related to the specified ClientID, including allowed brokerages and data access. + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.ReferenceDataApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + try { + PartnerData result = client + .referenceData + .getPartnerInfo() + .execute(); + System.out.println(result); + System.out.println(result.getRedirectUri()); + System.out.println(result.getAllowedBrokerages()); + System.out.println(result.getName()); + System.out.println(result.getSlug()); + System.out.println(result.getLogoUrl()); + System.out.println(result.getPinRequired()); + System.out.println(result.getCanAccessTrades()); + System.out.println(result.getCanAccessHoldings()); + System.out.println(result.getCanAccessAccountHistory()); + System.out.println(result.getCanAccessReferenceData()); + System.out.println(result.getCanAccessPortfolioManagement()); + System.out.println(result.getCanAccessOrders()); + } catch (ApiException e) { + System.err.println("Exception when calling ReferenceDataApi#getPartnerInfo"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse response = client + .referenceData + .getPartnerInfo() + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling ReferenceDataApi#getPartnerInfo"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**PartnerData**](PartnerData.md) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successfully obtained encrypted JWT data. See description on how to object JWT token | - | +| **500** | Unexpected Error | - | + + +# **getSecurityTypes** +> List<SecurityType> getSecurityTypes().execute(); + +List of all security types + +List security types available on SnapTrade. + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.ReferenceDataApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + try { + List result = client + .referenceData + .getSecurityTypes() + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ReferenceDataApi#getSecurityTypes"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse> response = client + .referenceData + .getSecurityTypes() + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling ReferenceDataApi#getSecurityTypes"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**List<SecurityType>**](SecurityType.md) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | A list of all defined Security Type objects. | - | +| **0** | Unexpected error. | - | + + +# **getStockExchanges** +> List<Exchange> getStockExchanges().execute(); + +Get exchanges + +Returns a list of all supported Exchanges. + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.ReferenceDataApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + try { + List result = client + .referenceData + .getStockExchanges() + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ReferenceDataApi#getStockExchanges"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse> response = client + .referenceData + .getStockExchanges() + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling ReferenceDataApi#getStockExchanges"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**List<Exchange>**](Exchange.md) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | A list of all supported stock exchanges | - | + + +# **getSymbols** +> List<UniversalSymbol> getSymbols().symbolQuery(symbolQuery).execute(); + +Search for symbols + +Returns a list of Universal Symbol objects that match a defined string. Matches on ticker or name. + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.ReferenceDataApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + String substring = "substring_example"; + try { + List result = client + .referenceData + .getSymbols() + .substring(substring) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ReferenceDataApi#getSymbols"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse> response = client + .referenceData + .getSymbols() + .substring(substring) + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling ReferenceDataApi#getSymbols"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **symbolQuery** | [**SymbolQuery**](SymbolQuery.md)| | [optional] | + +### Return type + +[**List<UniversalSymbol>**](UniversalSymbol.md) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | A list of UniversalSymbol objects which match the specified substring | - | +| **0** | Unexpected error. | - | + + +# **getSymbolsByTicker** +> UniversalSymbol getSymbolsByTicker(query).execute(); + +Get details of a symbol + +Returns the Universal Symbol object specified by the ticker or the universal_symbol_id. + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.ReferenceDataApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + String query = "query_example"; // The ticker or universal_symbol_id of the UniversalSymbol to get. + try { + UniversalSymbol result = client + .referenceData + .getSymbolsByTicker(query) + .execute(); + System.out.println(result); + System.out.println(result.getId()); + System.out.println(result.getSymbol()); + System.out.println(result.getRawSymbol()); + System.out.println(result.getDescription()); + System.out.println(result.getCurrency()); + System.out.println(result.getExchange()); + System.out.println(result.getType()); + System.out.println(result.getCurrencies()); + System.out.println(result.getFigiCode()); + System.out.println(result.getFigiInstrument()); + } catch (ApiException e) { + System.err.println("Exception when calling ReferenceDataApi#getSymbolsByTicker"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse response = client + .referenceData + .getSymbolsByTicker(query) + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling ReferenceDataApi#getSymbolsByTicker"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **query** | **String**| The ticker or universal_symbol_id of the UniversalSymbol to get. | | + +### Return type + +[**UniversalSymbol**](UniversalSymbol.md) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successfully gets a symbol | - | +| **404** | No symbol with the specified ticker found. | - | +| **0** | Unexpected error | - | + + +# **listAllBrokerageAuthorizationType** +> List<BrokerageAuthorizationTypeReadOnly> listAllBrokerageAuthorizationType().brokerage(brokerage).execute(); + +Get all brokerage authorization types + +Returns a list of all defined Brokerage authorization Type objects. + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.ReferenceDataApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + String brokerage = "QUESTRADE,ALPACA"; // Comma separated value of brokerage slugs + try { + List result = client + .referenceData + .listAllBrokerageAuthorizationType() + .brokerage(brokerage) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ReferenceDataApi#listAllBrokerageAuthorizationType"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse> response = client + .referenceData + .listAllBrokerageAuthorizationType() + .brokerage(brokerage) + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling ReferenceDataApi#listAllBrokerageAuthorizationType"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **brokerage** | **String**| Comma separated value of brokerage slugs | [optional] | + +### Return type + +[**List<BrokerageAuthorizationTypeReadOnly>**](BrokerageAuthorizationTypeReadOnly.md) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | A list of all defined Brokerage Authorization Type objects. | - | +| **0** | Unexpected error. | - | + + +# **listAllBrokerages** +> List<Brokerage> listAllBrokerages().execute(); + +Get brokerages + +Returns a list of all defined Brokerage objects. + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.ReferenceDataApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + try { + List result = client + .referenceData + .listAllBrokerages() + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ReferenceDataApi#listAllBrokerages"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse> response = client + .referenceData + .listAllBrokerages() + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling ReferenceDataApi#listAllBrokerages"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**List<Brokerage>**](Brokerage.md) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | A list of all defined Brokerage objects. | - | +| **0** | Unexpected error. | - | + + +# **listAllCurrencies** +> List<Currency> listAllCurrencies().execute(); + +Get currencies + +Returns a list of all defined Currency objects. + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.ReferenceDataApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + try { + List result = client + .referenceData + .listAllCurrencies() + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ReferenceDataApi#listAllCurrencies"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse> response = client + .referenceData + .listAllCurrencies() + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling ReferenceDataApi#listAllCurrencies"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**List<Currency>**](Currency.md) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | A list of all currencies. | - | +| **0** | Unexpected error. | - | + + +# **listAllCurrenciesRates** +> List<ExchangeRatePairs> listAllCurrenciesRates().execute(); + +Get currency exchange rates + +Returns a list of all Exchange Rate Pairs for all supported Currencies. + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.ReferenceDataApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + try { + List result = client + .referenceData + .listAllCurrenciesRates() + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ReferenceDataApi#listAllCurrenciesRates"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse> response = client + .referenceData + .listAllCurrenciesRates() + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling ReferenceDataApi#listAllCurrenciesRates"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**List<ExchangeRatePairs>**](ExchangeRatePairs.md) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | A list of all exchange rates pairs for supported currencies | - | + + +# **symbolSearchUserAccount** +> List<UniversalSymbol> symbolSearchUserAccount(userId, userSecret, accountId).symbolQuery(symbolQuery).execute(); + +Search for symbols available in an account + +Returns a list of universal symbols that are supported by the specificied account. Returned symbols are based on the provided search string, matching on ticker and name. + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.ReferenceDataApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + String userId = "userId_example"; + String userSecret = "userSecret_example"; + UUID accountId = UUID.fromString("917c8734-8470-4a3e-a18f-57c3f2ee6631"); // The ID of the account to search for symbols within. + String substring = "substring_example"; + try { + List result = client + .referenceData + .symbolSearchUserAccount(userId, userSecret, accountId) + .substring(substring) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ReferenceDataApi#symbolSearchUserAccount"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse> response = client + .referenceData + .symbolSearchUserAccount(userId, userSecret, accountId) + .substring(substring) + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling ReferenceDataApi#symbolSearchUserAccount"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **userId** | **String**| | | +| **userSecret** | **String**| | | +| **accountId** | **UUID**| The ID of the account to search for symbols within. | | +| **symbolQuery** | [**SymbolQuery**](SymbolQuery.md)| | [optional] | + +### Return type + +[**List<UniversalSymbol>**](UniversalSymbol.md) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | List of universal symbol supported by account based on substring sent it | - | +| **0** | Unexpected error | - | + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/SecurityType.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/SecurityType.md new file mode 100644 index 0000000000..d5f05e7db9 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/SecurityType.md @@ -0,0 +1,17 @@ + + +# SecurityType + +Security Type + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **UUID** | | [optional] | +|**code** | **String** | | [optional] | +|**description** | **String** | | [optional] | +|**isSupported** | **Boolean** | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/SessionEvent.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/SessionEvent.md new file mode 100644 index 0000000000..375f11a0ad --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/SessionEvent.md @@ -0,0 +1,41 @@ + + +# SessionEvent + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **UUID** | | [optional] | +|**sessionEventType** | [**SessionEventTypeEnum**](#SessionEventTypeEnum) | | [optional] | +|**sessionId** | **UUID** | | [optional] | +|**userId** | **String** | SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable. | [optional] | +|**createdDate** | **String** | Time | [optional] | +|**brokerageStatusCode** | **Integer** | | [optional] | +|**brokerageAuthorizationId** | **UUID** | | [optional] | + + + +## Enum: SessionEventTypeEnum + +| Name | Value | +|---- | -----| +| OAUTH_REDIRECT | "OAUTH_REDIRECT" | +| DISCLAIMER_ACCEPTED | "DISCLAIMER_ACCEPTED" | +| BROKERAGE_CONNECTION_INITIATED | "BROKERAGE_CONNECTION_INITIATED" | +| BROKERAGE_RECONNECT_INITIATED | "BROKERAGE_RECONNECT_INITIATED" | +| BROKERAGE_AUTHENTICATION | "BROKERAGE_AUTHENTICATION" | +| OAUTH_BROKERAGE_AUTHENTICATION | "OAUTH_BROKERAGE_AUTHENTICATION" | +| MFA_REQUESTED | "MFA_REQUESTED" | +| MFA_SUBMITTED | "MFA_SUBMITTED" | +| MFA_CHOICE_REQUESTED | "MFA_CHOICE_REQUESTED" | +| MFA_CHOICE_SUBMITTED | "MFA_CHOICE_SUBMITTED" | +| CONNECTION_SUCCESSFUL | "CONNECTION_SUCCESSFUL" | +| CONNECTION_FAILED | "CONNECTION_FAILED" | +| PARTNER_REDIRECT | "PARTNER_REDIRECT" | +| CONNECTION_ABORTED | "CONNECTION_ABORTED" | +| SESSION_STARTED | "SESSION_STARTED" | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/SnapTradeAPIDisclaimerAcceptStatus.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/SnapTradeAPIDisclaimerAcceptStatus.md new file mode 100644 index 0000000000..f032e6f023 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/SnapTradeAPIDisclaimerAcceptStatus.md @@ -0,0 +1,15 @@ + + +# SnapTradeAPIDisclaimerAcceptStatus + +Status of user acceptance of SnapTrade API disclaimer + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**accepted** | **Boolean** | | [optional] | +|**timestamp** | **String** | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/SnapTradeHoldingsAccount.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/SnapTradeHoldingsAccount.md new file mode 100644 index 0000000000..33bc6c33b8 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/SnapTradeHoldingsAccount.md @@ -0,0 +1,21 @@ + + +# SnapTradeHoldingsAccount + +SnapTradeUser Investment Account + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **UUID** | | [optional] | +|**brokerageAuthorization** | [**BrokerageAuthorization**](BrokerageAuthorization.md) | | [optional] | +|**portfolioGroup** | **UUID** | | [optional] | +|**name** | **String** | | [optional] | +|**number** | **String** | | [optional] | +|**institutionName** | **String** | | [optional] | +|**syncStatus** | [**AccountSyncStatus**](AccountSyncStatus.md) | | [optional] | +|**meta** | **Map<String, Object>** | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/SnapTradeHoldingsAccountAccountId.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/SnapTradeHoldingsAccountAccountId.md new file mode 100644 index 0000000000..4e723d07e4 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/SnapTradeHoldingsAccountAccountId.md @@ -0,0 +1,23 @@ + + +# SnapTradeHoldingsAccountAccountId + +A single brokerage account at a financial institution. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **UUID** | Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade. | [optional] | +|**brokerageAuthorization** | **UUID** | Unique identifier for the connection (brokerage authorization). This is the UUID used to reference the connection in SnapTrade. | [optional] | +|**portfolioGroup** | **UUID** | Portfolio Group ID. Portfolio Groups have been deprecated. Please contact support if you have a usecase for it. | [optional] | +|**name** | **String** | A display name for the account. Either assigned by the user or by the financial institution itself. For certain institutions, SnapTrade appends the institution name to the account name for clarity. | [optional] | +|**number** | **String** | The account number assigned by the financial institution. | [optional] | +|**institutionName** | **String** | The name of the financial institution that holds the account. | [optional] | +|**balance** | [**AccountBalanceNullable**](AccountBalanceNullable.md) | | [optional] | +|**meta** | **Map<String, Object>** | Additional information about the account, such as account type, status, etc. This information is specific to the financial institution and there's no standard format for this data. Please use at your own risk. | [optional] | +|**cashRestrictions** | [**List<CashRestriction>**](CashRestriction.md) | This field is deprecated. | [optional] | +|**createdDate** | **OffsetDateTime** | Timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format indicating when the account was created in SnapTrade. This is _not_ the account opening date at the financial institution. | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/SnapTradeHoldingsTotalValue.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/SnapTradeHoldingsTotalValue.md new file mode 100644 index 0000000000..0e30df2542 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/SnapTradeHoldingsTotalValue.md @@ -0,0 +1,15 @@ + + +# SnapTradeHoldingsTotalValue + +The total market value of the account. Note that this field is calculated based on the sum of the values of account positions and cash balances known to SnapTrade. It may not be accurate if the brokerage account has holdings that SnapTrade is not aware of. For example, if the brokerage account holds assets that SnapTrade does not support, the total value may be underreported. To get the brokerage reported total market value of the account, refer to `account.balance.total`. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**value** | **Double** | Total value denominated in the currency of the `currency` field. | [optional] | +|**currency** | **String** | The ISO-4217 currency code for the amount. | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/SnapTradeLoginUserRequestBody.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/SnapTradeLoginUserRequestBody.md new file mode 100644 index 0000000000..ad921d34fd --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/SnapTradeLoginUserRequestBody.md @@ -0,0 +1,37 @@ + + +# SnapTradeLoginUserRequestBody + +Data to login a user via SnapTrade Partner + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**broker** | **String** | Slug of the brokerage to connect the user to. See [this document](https://snaptrade.notion.site/SnapTrade-Brokerage-Integrations-f83946a714a84c3caf599f6a945f0ead) for a list of supported brokerages and their slugs. | [optional] | +|**immediateRedirect** | **Boolean** | When set to True, user will be redirected back to the partner's site instead of the connection portal | [optional] | +|**customRedirect** | **String** | URL to redirect the user to after the user connects their brokerage account | [optional] | +|**reconnect** | **String** | The UUID of the brokerage connection to be reconnected. This parameter should be left empty unless you are reconnecting a disabled connection. See ‘Reconnecting Accounts’ for more information. | [optional] | +|**connectionType** | [**ConnectionTypeEnum**](#ConnectionTypeEnum) | Sets whether the connection should be read or trade | [optional] | +|**connectionPortalVersion** | [**ConnectionPortalVersionEnum**](#ConnectionPortalVersionEnum) | Sets the version of the connection portal to render, with a default to 'v3' | [optional] | + + + +## Enum: ConnectionTypeEnum + +| Name | Value | +|---- | -----| +| READ | "read" | +| TRADE | "trade" | + + + +## Enum: ConnectionPortalVersionEnum + +| Name | Value | +|---- | -----| +| V2 | "v2" | +| V3 | "v3" | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/SnapTradeRegisterUserRequestBody.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/SnapTradeRegisterUserRequestBody.md new file mode 100644 index 0000000000..5e3ea49540 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/SnapTradeRegisterUserRequestBody.md @@ -0,0 +1,14 @@ + + +# SnapTradeRegisterUserRequestBody + +Data required to register a user via SnapTrade Partner + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**userId** | **String** | SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable. | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/Status.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/Status.md new file mode 100644 index 0000000000..efbf956742 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/Status.md @@ -0,0 +1,16 @@ + + +# Status + +Status of API + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**version** | **Integer** | | [optional] | +|**timestamp** | **String** | | [optional] | +|**online** | **Boolean** | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/StrategyImpact.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/StrategyImpact.md new file mode 100644 index 0000000000..d5424eca07 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/StrategyImpact.md @@ -0,0 +1,24 @@ + + +# StrategyImpact + +The strategy impact + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**estimatedCommissions** | **Double** | | [optional] | +|**buyingPowerEffect** | **Double** | | [optional] | +|**buyingPowerResult** | **Double** | | [optional] | +|**maintExcessEffect** | **Double** | | [optional] | +|**maintExcessResult** | **Double** | | [optional] | +|**tradeValueCalculation** | **String** | | [optional] | +|**legs** | [**List<StrategyImpactLegsInner>**](StrategyImpactLegsInner.md) | | [optional] | +|**side** | **String** | | [optional] | +|**effect** | **String** | | [optional] | +|**price** | **Double** | | [optional] | +|**strategy** | **String** | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/StrategyImpactLegsInner.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/StrategyImpactLegsInner.md new file mode 100644 index 0000000000..38099c0ba1 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/StrategyImpactLegsInner.md @@ -0,0 +1,19 @@ + + +# StrategyImpactLegsInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**legId** | **Integer** | | [optional] | +|**symbol** | **String** | | [optional] | +|**symbolId** | **Integer** | | [optional] | +|**legRatioQuantity** | **Integer** | | [optional] | +|**side** | **String** | | [optional] | +|**avgExecPrice** | **String** | | [optional] | +|**lastExecPrice** | **String** | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/StrategyOrderPlace.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/StrategyOrderPlace.md new file mode 100644 index 0000000000..0dde12ae0f --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/StrategyOrderPlace.md @@ -0,0 +1,15 @@ + + +# StrategyOrderPlace + +The reponse for a correctly placed order + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**orderId** | **Integer** | | [optional] | +|**orders** | [**List<StrategyOrderPlaceOrdersInner>**](StrategyOrderPlaceOrdersInner.md) | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/StrategyOrderPlaceOrdersInner.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/StrategyOrderPlaceOrdersInner.md new file mode 100644 index 0000000000..78a4cc6e8e --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/StrategyOrderPlaceOrdersInner.md @@ -0,0 +1,55 @@ + + +# StrategyOrderPlaceOrdersInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Integer** | | [optional] | +|**symbol** | **String** | | [optional] | +|**symbolId** | **Integer** | | [optional] | +|**totalQuantity** | **Integer** | | [optional] | +|**openQuantity** | **Integer** | | [optional] | +|**filledQuantity** | **Integer** | | [optional] | +|**canceledQuantity** | **Integer** | | [optional] | +|**side** | **String** | | [optional] | +|**orderType** | **String** | | [optional] | +|**limitPrice** | **String** | | [optional] | +|**stopPrice** | **String** | | [optional] | +|**isAllOrNone** | **Boolean** | | [optional] | +|**isAnonymous** | **Boolean** | | [optional] | +|**icebergQuantity** | **String** | | [optional] | +|**minQuantity** | **String** | | [optional] | +|**avgExecPrice** | **Integer** | | [optional] | +|**lastExecPrice** | **String** | | [optional] | +|**source** | **String** | | [optional] | +|**timeInForce** | **String** | | [optional] | +|**gtdDate** | **String** | | [optional] | +|**state** | **String** | | [optional] | +|**rejectionReason** | **String** | | [optional] | +|**chainId** | **Integer** | | [optional] | +|**creationTime** | **String** | | [optional] | +|**updateTime** | **String** | | [optional] | +|**notes** | **String** | | [optional] | +|**primaryRoute** | **String** | | [optional] | +|**secondaryRoute** | **String** | | [optional] | +|**orderRoute** | **String** | | [optional] | +|**venueHoldingOrder** | **String** | | [optional] | +|**comissionCharged** | **Integer** | | [optional] | +|**exchangeOrderId** | **String** | | [optional] | +|**isSignificantShareHolder** | **Boolean** | | [optional] | +|**isInsider** | **Boolean** | | [optional] | +|**isLimitOffsetInDollar** | **Boolean** | | [optional] | +|**userId** | **Integer** | | [optional] | +|**placementCommission** | **String** | | [optional] | +|**legs** | [**List<StrategyOrderPlaceOrdersInnerLegsInner>**](StrategyOrderPlaceOrdersInnerLegsInner.md) | | [optional] | +|**strategyType** | **String** | | [optional] | +|**triggerStopPrice** | **String** | | [optional] | +|**orderGroupId** | **Integer** | | [optional] | +|**orderClass** | **String** | | [optional] | +|**isCrossZero** | **Boolean** | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/StrategyOrderPlaceOrdersInnerLegsInner.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/StrategyOrderPlaceOrdersInnerLegsInner.md new file mode 100644 index 0000000000..daf9f7e091 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/StrategyOrderPlaceOrdersInnerLegsInner.md @@ -0,0 +1,19 @@ + + +# StrategyOrderPlaceOrdersInnerLegsInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**legId** | **Integer** | | [optional] | +|**symbol** | **String** | | [optional] | +|**symbolId** | **Integer** | | [optional] | +|**legRatioQuantity** | **Integer** | | [optional] | +|**side** | **String** | | [optional] | +|**avgExecPrice** | **Integer** | | [optional] | +|**lastExecPrice** | **String** | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/StrategyOrderRecord.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/StrategyOrderRecord.md new file mode 100644 index 0000000000..56202084a5 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/StrategyOrderRecord.md @@ -0,0 +1,50 @@ + + +# StrategyOrderRecord + +Strategy order record + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**strategy** | [**OptionStrategy**](OptionStrategy.md) | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | | [optional] | +|**filledQuantity** | **Double** | | [optional] | +|**openQuantity** | **Double** | | [optional] | +|**closedQuantity** | **Double** | | [optional] | +|**orderType** | **String** | Order Type potential values include (but are not limited to) - Limit - Market - StopLimit - StopLoss | [optional] | +|**timeInForce** | **String** | Trade time in force examples: * FOK - Fill Or Kill * Day - Day * GTC - Good Til Canceled * GTD - Good Til Date | [optional] | +|**limitPrice** | **Double** | Trade Price if limit or stop limit order | [optional] | +|**executionPrice** | **Double** | Trade Price if limit or stop limit order | [optional] | +|**timePlaced** | **String** | Time | [optional] | +|**timeUpdated** | **String** | Time | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| PENDING | "PENDING" | +| ACCEPTED | "ACCEPTED" | +| FAILED | "FAILED" | +| REJECTED | "REJECTED" | +| CANCELED | "CANCELED" | +| PARTIAL_CANCELED | "PARTIAL_CANCELED" | +| CANCEL_PENDING | "CANCEL_PENDING" | +| EXECUTED | "EXECUTED" | +| PARTIAL | "PARTIAL" | +| REPLACE_PENDING | "REPLACE_PENDING" | +| REPLACED | "REPLACED" | +| STOPPED | "STOPPED" | +| SUSPENDED | "SUSPENDED" | +| EXPIRED | "EXPIRED" | +| QUEUED | "QUEUED" | +| TRIGGERED | "TRIGGERED" | +| ACTIVATED | "ACTIVATED" | +| PENDING_RISK_REVIEW | "PENDING_RISK_REVIEW" | +| CONTINGENT_ORDER | "CONTINGENT_ORDER" | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/StrategyQuotes.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/StrategyQuotes.md new file mode 100644 index 0000000000..253a91aad4 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/StrategyQuotes.md @@ -0,0 +1,18 @@ + + +# StrategyQuotes + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**strategy** | [**OptionStrategy**](OptionStrategy.md) | | [optional] | +|**openPrice** | **Double** | Trade Price if limit or stop limit order | [optional] | +|**bidPrice** | **Double** | Trade Price if limit or stop limit order | [optional] | +|**askPrice** | **Double** | Trade Price if limit or stop limit order | [optional] | +|**volatility** | **Double** | | [optional] | +|**greek** | [**StrategyQuotesGreek**](StrategyQuotesGreek.md) | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/StrategyQuotesGreek.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/StrategyQuotesGreek.md new file mode 100644 index 0000000000..773ccd63b8 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/StrategyQuotesGreek.md @@ -0,0 +1,17 @@ + + +# StrategyQuotesGreek + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**delta** | **Double** | | [optional] | +|**gamma** | **Double** | | [optional] | +|**theta** | **Double** | | [optional] | +|**vega** | **Double** | | [optional] | +|**rho** | **Double** | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/SubPeriodReturnRate.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/SubPeriodReturnRate.md new file mode 100644 index 0000000000..b4b657f861 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/SubPeriodReturnRate.md @@ -0,0 +1,15 @@ + + +# SubPeriodReturnRate + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**periodStart** | **LocalDate** | Date used to specify timeframe for a reporting call (in YYYY-MM-DD format) | [optional] | +|**periodEnd** | **LocalDate** | Date used to specify timeframe for a reporting call (in YYYY-MM-DD format) | [optional] | +|**rateOfReturn** | **Double** | The return rate for the given period | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/Symbol.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/Symbol.md new file mode 100644 index 0000000000..14b5d9e1c5 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/Symbol.md @@ -0,0 +1,22 @@ + + +# Symbol + +Symbol + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **UUID** | | [optional] | +|**symbol** | **String** | | [optional] | +|**rawSymbol** | **String** | | [optional] | +|**name** | **String** | | [optional] | +|**currency** | [**Currency**](Currency.md) | | [optional] | +|**exchange** | [**Exchange**](Exchange.md) | | [optional] | +|**type** | [**SecurityType**](SecurityType.md) | | [optional] | +|**figiCode** | **String** | | [optional] | +|**figiInstrument** | [**FigiInstrumentNullable**](FigiInstrumentNullable.md) | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/SymbolQuery.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/SymbolQuery.md new file mode 100644 index 0000000000..dbc1009216 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/SymbolQuery.md @@ -0,0 +1,14 @@ + + +# SymbolQuery + +Symbol query for searching for symbols + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**substring** | **String** | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/SymbolsQuotesInner.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/SymbolsQuotesInner.md new file mode 100644 index 0000000000..78d877b19c --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/SymbolsQuotesInner.md @@ -0,0 +1,18 @@ + + +# SymbolsQuotesInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**symbol** | [**UniversalSymbol**](UniversalSymbol.md) | | [optional] | +|**bidPrice** | **Double** | | [optional] | +|**askPrice** | **Double** | | [optional] | +|**lastTradePrice** | **Double** | | [optional] | +|**bidSize** | **Double** | | [optional] | +|**askSize** | **Double** | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/TargetAsset.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/TargetAsset.md new file mode 100644 index 0000000000..10d235a40e --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/TargetAsset.md @@ -0,0 +1,19 @@ + + +# TargetAsset + +Target percentage of a certain asset + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **UUID** | | [optional] | +|**symbol** | [**UniversalSymbol**](UniversalSymbol.md) | | [optional] | +|**percent** | **Double** | | [optional] | +|**isSupported** | **Boolean** | | [optional] | +|**isExcluded** | **Boolean** | | [optional] | +|**meta** | **Map<String, Object>** | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/TimeInForceStrict.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/TimeInForceStrict.md new file mode 100644 index 0000000000..16115b583a --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/TimeInForceStrict.md @@ -0,0 +1,15 @@ + + +# TimeInForceStrict + +## Enum + + +* `FOK` (value: `"FOK"`) + +* `DAY` (value: `"Day"`) + +* `GTC` (value: `"GTC"`) + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/Trade.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/Trade.md new file mode 100644 index 0000000000..5f965256bc --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/Trade.md @@ -0,0 +1,30 @@ + + +# Trade + +A trade object + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **UUID** | | [optional] | +|**account** | [**Account**](Account.md) | | [optional] | +|**symbol** | [**BrokerageSymbol**](BrokerageSymbol.md) | | [optional] | +|**universalSymbol** | [**UniversalSymbol**](UniversalSymbol.md) | | [optional] | +|**action** | [**ActionEnum**](#ActionEnum) | | [optional] | +|**units** | **Integer** | | [optional] | +|**price** | **Double** | | [optional] | +|**sequence** | **Integer** | | [optional] | + + + +## Enum: ActionEnum + +| Name | Value | +|---- | -----| +| BUY | "BUY" | +| SELL | "SELL" | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/TradeExecutionStatus.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/TradeExecutionStatus.md new file mode 100644 index 0000000000..43a3734c73 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/TradeExecutionStatus.md @@ -0,0 +1,43 @@ + + +# TradeExecutionStatus + +Execution status of a trade + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**symbol** | [**BrokerageSymbol**](BrokerageSymbol.md) | | [optional] | +|**universalSymbol** | [**UniversalSymbol**](UniversalSymbol.md) | | [optional] | +|**trade** | [**Trade**](Trade.md) | | [optional] | +|**state** | [**StateEnum**](#StateEnum) | Execution state of a trade | [optional] | +|**filledUnits** | **Integer** | Number of filled units | [optional] | +|**action** | [**ActionEnum**](#ActionEnum) | Action of executed trade | [optional] | +|**price** | **Double** | Price of execution | [optional] | +|**commissions** | **Double** | Fees paid from executing trade | [optional] | +|**meta** | **Map<String, Object>** | Other misc. data | [optional] | + + + +## Enum: StateEnum + +| Name | Value | +|---- | -----| +| EXECUTED | "Executed" | +| CANCELED | "Canceled" | +| REJECTED | "Rejected" | +| FAILED | "Failed" | +| NOT_EXECUTED | "Not Executed" | + + + +## Enum: ActionEnum + +| Name | Value | +|---- | -----| +| BUY | "BUY" | +| SELL | "SELL" | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/TradeImpact.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/TradeImpact.md new file mode 100644 index 0000000000..c6ace6c4a5 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/TradeImpact.md @@ -0,0 +1,18 @@ + + +# TradeImpact + +Impact of a group of trade + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**account** | [**Account**](Account.md) | | [optional] | +|**currency** | [**Currency**](Currency.md) | | [optional] | +|**remainingCash** | **Double** | Remaining balance after executing all trades | [optional] | +|**estimatedCommissions** | **Double** | Total estimated commissions across all trades to make | [optional] | +|**forexFees** | **Double** | Estimated forex fees to pay to excute trades | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/TradingApi.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/TradingApi.md new file mode 100644 index 0000000000..e75bec7ae6 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/TradingApi.md @@ -0,0 +1,622 @@ +# TradingApi + +All URIs are relative to *https://api.snaptrade.com/api/v1* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**cancelUserAccountOrder**](TradingApi.md#cancelUserAccountOrder) | **POST** /accounts/{accountId}/orders/cancel | Cancel open order in account | +| [**getOrderImpact**](TradingApi.md#getOrderImpact) | **POST** /trade/impact | Check the impact of a trade on an account | +| [**getUserAccountQuotes**](TradingApi.md#getUserAccountQuotes) | **GET** /accounts/{accountId}/quotes | Get symbol quotes | +| [**placeForceOrder**](TradingApi.md#placeForceOrder) | **POST** /trade/place | Place a trade with NO validation. | +| [**placeOrder**](TradingApi.md#placeOrder) | **POST** /trade/{tradeId} | Place order | + + + +# **cancelUserAccountOrder** +> AccountOrderRecord cancelUserAccountOrder(userId, userSecret, accountId, tradingCancelUserAccountOrderRequest).execute(); + +Cancel open order in account + +Sends a signal to the brokerage to cancel the specified order. This will only work if the order has not yet been executed. + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.TradingApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + String userId = "userId_example"; + String userSecret = "userSecret_example"; + UUID accountId = UUID.fromString("917c8734-8470-4a3e-a18f-57c3f2ee6631"); // The ID of the account to cancel the order in. + UUID brokerageOrderId = UUID.randomUUID(); + try { + AccountOrderRecord result = client + .trading + .cancelUserAccountOrder(userId, userSecret, accountId) + .brokerageOrderId(brokerageOrderId) + .execute(); + System.out.println(result); + System.out.println(result.getBrokerageOrderId()); + System.out.println(result.getStatus()); + System.out.println(result.getSymbol()); + System.out.println(result.getUniversalSymbol()); + System.out.println(result.getOptionSymbol()); + System.out.println(result.getAction()); + System.out.println(result.getTotalQuantity()); + System.out.println(result.getOpenQuantity()); + System.out.println(result.getCanceledQuantity()); + System.out.println(result.getFilledQuantity()); + System.out.println(result.getExecutionPrice()); + System.out.println(result.getLimitPrice()); + System.out.println(result.getStopPrice()); + System.out.println(result.getOrderType()); + System.out.println(result.getTimeInForce()); + System.out.println(result.getTimePlaced()); + System.out.println(result.getTimeUpdated()); + System.out.println(result.getTimeExecuted()); + System.out.println(result.getExpiryDate()); + } catch (ApiException e) { + System.err.println("Exception when calling TradingApi#cancelUserAccountOrder"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse response = client + .trading + .cancelUserAccountOrder(userId, userSecret, accountId) + .brokerageOrderId(brokerageOrderId) + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling TradingApi#cancelUserAccountOrder"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **userId** | **String**| | | +| **userSecret** | **String**| | | +| **accountId** | **UUID**| The ID of the account to cancel the order in. | | +| **tradingCancelUserAccountOrderRequest** | [**TradingCancelUserAccountOrderRequest**](TradingCancelUserAccountOrderRequest.md)| The Order ID to be canceled | | + +### Return type + +[**AccountOrderRecord**](AccountOrderRecord.md) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Order Record of canceled order | - | + + +# **getOrderImpact** +> ManualTradeAndImpact getOrderImpact(userId, userSecret, manualTradeForm).execute(); + +Check the impact of a trade on an account + +Return the trade object and it's impact on the account for the specified order. + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.TradingApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + String userId = "userId_example"; + String userSecret = "userSecret_example"; + UUID accountId = UUID.randomUUID(); + ActionStrict action = ActionStrict.fromValue("BUY"); + OrderTypeStrict orderType = OrderTypeStrict.fromValue("Limit"); + Double price = 3.4D; // Trade Price if limit or stop limit order + Double stop = 3.4D; // Stop Price. If stop loss or stop limit order, the price to trigger the stop + TimeInForceStrict timeInForce = TimeInForceStrict.fromValue("FOK"); + Double units = 3.4D; // Trade Units. Cannot work with notional value. + UUID universalSymbolId = UUID.randomUUID(); + Object notionalValue = null; + try { + ManualTradeAndImpact result = client + .trading + .getOrderImpact(userId, userSecret) + .accountId(accountId) + .action(action) + .orderType(orderType) + .price(price) + .stop(stop) + .timeInForce(timeInForce) + .units(units) + .universalSymbolId(universalSymbolId) + .notionalValue(notionalValue) + .execute(); + System.out.println(result); + System.out.println(result.getTrade()); + System.out.println(result.getTradeImpacts()); + System.out.println(result.getCombinedRemainingBalance()); + } catch (ApiException e) { + System.err.println("Exception when calling TradingApi#getOrderImpact"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse response = client + .trading + .getOrderImpact(userId, userSecret) + .accountId(accountId) + .action(action) + .orderType(orderType) + .price(price) + .stop(stop) + .timeInForce(timeInForce) + .units(units) + .universalSymbolId(universalSymbolId) + .notionalValue(notionalValue) + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling TradingApi#getOrderImpact"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **userId** | **String**| | | +| **userSecret** | **String**| | | +| **manualTradeForm** | [**ManualTradeForm**](ManualTradeForm.md)| | | + +### Return type + +[**ManualTradeAndImpact**](ManualTradeAndImpact.md) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Return trade object and it's impact on the account | - | +| **500** | Unexpected Error | - | + + +# **getUserAccountQuotes** +> List<SymbolsQuotesInner> getUserAccountQuotes(userId, userSecret, symbols, accountId).useTicker(useTicker).execute(); + +Get symbol quotes + +Returns quote(s) from the brokerage for the specified symbol(s). + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.TradingApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + String userId = "userId_example"; + String userSecret = "userSecret_example"; + String symbols = "symbols_example"; // List of universal_symbol_id or tickers to get quotes for. + UUID accountId = UUID.fromString("917c8734-8470-4a3e-a18f-57c3f2ee6631"); // The ID of the account to get quotes. + Boolean useTicker = true; // Should be set to True if providing tickers. + try { + List result = client + .trading + .getUserAccountQuotes(userId, userSecret, symbols, accountId) + .useTicker(useTicker) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TradingApi#getUserAccountQuotes"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse> response = client + .trading + .getUserAccountQuotes(userId, userSecret, symbols, accountId) + .useTicker(useTicker) + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling TradingApi#getUserAccountQuotes"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **userId** | **String**| | | +| **userSecret** | **String**| | | +| **symbols** | **String**| List of universal_symbol_id or tickers to get quotes for. | | +| **accountId** | **UUID**| The ID of the account to get quotes. | | +| **useTicker** | **Boolean**| Should be set to True if providing tickers. | [optional] | + +### Return type + +[**List<SymbolsQuotesInner>**](SymbolsQuotesInner.md) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Returns quotes object with different prices | - | + + +# **placeForceOrder** +> AccountOrderRecord placeForceOrder(userId, userSecret, manualTradeForm).execute(); + +Place a trade with NO validation. + +Places a specified trade in the specified account. + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.TradingApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + String userId = "userId_example"; + String userSecret = "userSecret_example"; + UUID accountId = UUID.randomUUID(); + ActionStrict action = ActionStrict.fromValue("BUY"); + OrderTypeStrict orderType = OrderTypeStrict.fromValue("Limit"); + Double price = 3.4D; // Trade Price if limit or stop limit order + Double stop = 3.4D; // Stop Price. If stop loss or stop limit order, the price to trigger the stop + TimeInForceStrict timeInForce = TimeInForceStrict.fromValue("FOK"); + Double units = 3.4D; // Trade Units. Cannot work with notional value. + UUID universalSymbolId = UUID.randomUUID(); + Object notionalValue = null; + try { + AccountOrderRecord result = client + .trading + .placeForceOrder(userId, userSecret) + .accountId(accountId) + .action(action) + .orderType(orderType) + .price(price) + .stop(stop) + .timeInForce(timeInForce) + .units(units) + .universalSymbolId(universalSymbolId) + .notionalValue(notionalValue) + .execute(); + System.out.println(result); + System.out.println(result.getBrokerageOrderId()); + System.out.println(result.getStatus()); + System.out.println(result.getSymbol()); + System.out.println(result.getUniversalSymbol()); + System.out.println(result.getOptionSymbol()); + System.out.println(result.getAction()); + System.out.println(result.getTotalQuantity()); + System.out.println(result.getOpenQuantity()); + System.out.println(result.getCanceledQuantity()); + System.out.println(result.getFilledQuantity()); + System.out.println(result.getExecutionPrice()); + System.out.println(result.getLimitPrice()); + System.out.println(result.getStopPrice()); + System.out.println(result.getOrderType()); + System.out.println(result.getTimeInForce()); + System.out.println(result.getTimePlaced()); + System.out.println(result.getTimeUpdated()); + System.out.println(result.getTimeExecuted()); + System.out.println(result.getExpiryDate()); + } catch (ApiException e) { + System.err.println("Exception when calling TradingApi#placeForceOrder"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse response = client + .trading + .placeForceOrder(userId, userSecret) + .accountId(accountId) + .action(action) + .orderType(orderType) + .price(price) + .stop(stop) + .timeInForce(timeInForce) + .units(units) + .universalSymbolId(universalSymbolId) + .notionalValue(notionalValue) + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling TradingApi#placeForceOrder"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **userId** | **String**| | | +| **userSecret** | **String**| | | +| **manualTradeForm** | [**ManualTradeForm**](ManualTradeForm.md)| | | + +### Return type + +[**AccountOrderRecord**](AccountOrderRecord.md) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Trade sucessfully placed | - | +| **500** | Unexpected Error | - | + + +# **placeOrder** +> AccountOrderRecord placeOrder(tradeId, userId, userSecret).validatedTradeBody(validatedTradeBody).execute(); + +Place order + +Places the specified trade object. This places the order in the account and returns the status of the order from the brokerage. + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.TradingApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + UUID tradeId = UUID.randomUUID(); // The ID of trade object obtained from trade/impact endpoint + String userId = "userId_example"; + String userSecret = "userSecret_example"; + Boolean waitToConfirm = true; // Optional, defaults to true. Determines if a wait is performed to check on order status. If false, latency will be reduced but orders returned will be more likely to be of status PENDING as we will not wait to check on the status before responding to the request + try { + AccountOrderRecord result = client + .trading + .placeOrder(tradeId, userId, userSecret) + .waitToConfirm(waitToConfirm) + .execute(); + System.out.println(result); + System.out.println(result.getBrokerageOrderId()); + System.out.println(result.getStatus()); + System.out.println(result.getSymbol()); + System.out.println(result.getUniversalSymbol()); + System.out.println(result.getOptionSymbol()); + System.out.println(result.getAction()); + System.out.println(result.getTotalQuantity()); + System.out.println(result.getOpenQuantity()); + System.out.println(result.getCanceledQuantity()); + System.out.println(result.getFilledQuantity()); + System.out.println(result.getExecutionPrice()); + System.out.println(result.getLimitPrice()); + System.out.println(result.getStopPrice()); + System.out.println(result.getOrderType()); + System.out.println(result.getTimeInForce()); + System.out.println(result.getTimePlaced()); + System.out.println(result.getTimeUpdated()); + System.out.println(result.getTimeExecuted()); + System.out.println(result.getExpiryDate()); + } catch (ApiException e) { + System.err.println("Exception when calling TradingApi#placeOrder"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse response = client + .trading + .placeOrder(tradeId, userId, userSecret) + .waitToConfirm(waitToConfirm) + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling TradingApi#placeOrder"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **tradeId** | **UUID**| The ID of trade object obtained from trade/impact endpoint | | +| **userId** | **String**| | | +| **userSecret** | **String**| | | +| **validatedTradeBody** | [**ValidatedTradeBody**](ValidatedTradeBody.md)| | [optional] | + +### Return type + +[**AccountOrderRecord**](AccountOrderRecord.md) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Status of order placed | - | +| **500** | Unexpected Error | - | + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/TradingCancelUserAccountOrderRequest.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/TradingCancelUserAccountOrderRequest.md new file mode 100644 index 0000000000..c5f9e8112f --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/TradingCancelUserAccountOrderRequest.md @@ -0,0 +1,13 @@ + + +# TradingCancelUserAccountOrderRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**brokerageOrderId** | **UUID** | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/TransactionsAndReportingApi.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/TransactionsAndReportingApi.md new file mode 100644 index 0000000000..72c01860a5 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/TransactionsAndReportingApi.md @@ -0,0 +1,255 @@ +# TransactionsAndReportingApi + +All URIs are relative to *https://api.snaptrade.com/api/v1* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**getActivities**](TransactionsAndReportingApi.md#getActivities) | **GET** /activities | Get transaction history for a user | +| [**getReportingCustomRange**](TransactionsAndReportingApi.md#getReportingCustomRange) | **GET** /performance/custom | Get performance information for a specific timeframe | + + + +# **getActivities** +> List<UniversalActivity> getActivities(userId, userSecret).startDate(startDate).endDate(endDate).accounts(accounts).brokerageAuthorizations(brokerageAuthorizations).type(type).execute(); + +Get transaction history for a user + +Returns activities (transactions) for a user. Specifying start and end date is highly recommended for better performance + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.TransactionsAndReportingApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + String userId = "userId_example"; + String userSecret = "userSecret_example"; + LocalDate startDate = LocalDate.now(); + LocalDate endDate = LocalDate.now(); + String accounts = "accounts_example"; // Optional comma seperated list of account IDs used to filter the request on specific accounts + String brokerageAuthorizations = "brokerageAuthorizations_example"; // Optional comma seperated list of brokerage authorization IDs used to filter the request on only accounts that belong to those authorizations + String type = "DIVIDEND"; // Optional comma seperated list of types to filter activities by. This is not an exhaustive list, if we fail to match to these types, we will return the raw description from the brokerage. Potential values include - DIVIDEND - BUY - SELL - CONTRIBUTION - WITHDRAWAL - EXTERNAL_ASSET_TRANSFER_IN - EXTERNAL_ASSET_TRANSFER_OUT - INTERNAL_CASH_TRANSFER_IN - INTERNAL_CASH_TRANSFER_OUT - INTERNAL_ASSET_TRANSFER_IN - INTERNAL_ASSET_TRANSFER_OUT - INTEREST - REBATE - GOV_GRANT - TAX - FEE - REI - FXT + try { + List result = client + .transactionsAndReporting + .getActivities(userId, userSecret) + .startDate(startDate) + .endDate(endDate) + .accounts(accounts) + .brokerageAuthorizations(brokerageAuthorizations) + .type(type) + .execute(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TransactionsAndReportingApi#getActivities"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse> response = client + .transactionsAndReporting + .getActivities(userId, userSecret) + .startDate(startDate) + .endDate(endDate) + .accounts(accounts) + .brokerageAuthorizations(brokerageAuthorizations) + .type(type) + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling TransactionsAndReportingApi#getActivities"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **userId** | **String**| | | +| **userSecret** | **String**| | | +| **startDate** | **LocalDate**| | [optional] | +| **endDate** | **LocalDate**| | [optional] | +| **accounts** | **String**| Optional comma seperated list of account IDs used to filter the request on specific accounts | [optional] | +| **brokerageAuthorizations** | **String**| Optional comma seperated list of brokerage authorization IDs used to filter the request on only accounts that belong to those authorizations | [optional] | +| **type** | **String**| Optional comma seperated list of types to filter activities by. This is not an exhaustive list, if we fail to match to these types, we will return the raw description from the brokerage. Potential values include - DIVIDEND - BUY - SELL - CONTRIBUTION - WITHDRAWAL - EXTERNAL_ASSET_TRANSFER_IN - EXTERNAL_ASSET_TRANSFER_OUT - INTERNAL_CASH_TRANSFER_IN - INTERNAL_CASH_TRANSFER_OUT - INTERNAL_ASSET_TRANSFER_IN - INTERNAL_ASSET_TRANSFER_OUT - INTEREST - REBATE - GOV_GRANT - TAX - FEE - REI - FXT | [optional] | + +### Return type + +[**List<UniversalActivity>**](UniversalActivity.md) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successfully retrieved transaction history | - | +| **0** | Unexpected error | - | + + +# **getReportingCustomRange** +> PerformanceCustom getReportingCustomRange(startDate, endDate, userId, userSecret).accounts(accounts).detailed(detailed).frequency(frequency).execute(); + +Get performance information for a specific timeframe + +Returns performance information (contributions, dividends, rate of return, etc) for a specific timeframe. Please note that Total Equity Timeframe and Rate of Returns are experimental features. Please contact support@snaptrade.com if you notice any inconsistencies. + +### Example +```java +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.auth.*; +import com.konfigthis.client.model.*; +import com.konfigthis.client.api.TransactionsAndReportingApi; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + LocalDate startDate = LocalDate.now(); + LocalDate endDate = LocalDate.now(); + String userId = "userId_example"; + String userSecret = "userSecret_example"; + String accounts = "accounts_example"; // Optional comma seperated list of account IDs used to filter the request on specific accounts + Boolean detailed = true; // Optional, increases frequency of data points for the total value and contribution charts if set to true + String frequency = "frequency_example"; // Optional frequency for the rate of return chart (defaults to monthly). Possible values are daily, weekly, monthly, quarterly, yearly. + try { + PerformanceCustom result = client + .transactionsAndReporting + .getReportingCustomRange(startDate, endDate, userId, userSecret) + .accounts(accounts) + .detailed(detailed) + .frequency(frequency) + .execute(); + System.out.println(result); + System.out.println(result.getTotalEquityTimeframe()); + System.out.println(result.getContributions()); + System.out.println(result.getContributionTimeframe()); + System.out.println(result.getContributionTimeframeCumulative()); + System.out.println(result.getWithdrawalTimeframe()); + System.out.println(result.getContributionStreak()); + System.out.println(result.getContributionMonthsContributed()); + System.out.println(result.getContributionTotalMonths()); + System.out.println(result.getDividends()); + System.out.println(result.getDividendIncome()); + System.out.println(result.getMonthlyDividends()); + System.out.println(result.getBadTickers()); + System.out.println(result.getDividendTimeline()); + System.out.println(result.getCommissions()); + System.out.println(result.getForexFees()); + System.out.println(result.getFees()); + System.out.println(result.getRateOfReturn()); + System.out.println(result.getReturnRateTimeframe()); + System.out.println(result.getDetailedMode()); + } catch (ApiException e) { + System.err.println("Exception when calling TransactionsAndReportingApi#getReportingCustomRange"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + + // Use .executeWithHttpInfo() to retrieve HTTP Status Code, Headers and Request + try { + ApiResponse response = client + .transactionsAndReporting + .getReportingCustomRange(startDate, endDate, userId, userSecret) + .accounts(accounts) + .detailed(detailed) + .frequency(frequency) + .executeWithHttpInfo(); + System.out.println(response.getResponseBody()); + System.out.println(response.getResponseHeaders()); + System.out.println(response.getStatusCode()); + System.out.println(response.getRoundTripTime()); + System.out.println(response.getRequest()); + } catch (ApiException e) { + System.err.println("Exception when calling TransactionsAndReportingApi#getReportingCustomRange"); + System.err.println("Status code: " + e.getStatusCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **startDate** | **LocalDate**| | | +| **endDate** | **LocalDate**| | | +| **userId** | **String**| | | +| **userSecret** | **String**| | | +| **accounts** | **String**| Optional comma seperated list of account IDs used to filter the request on specific accounts | [optional] | +| **detailed** | **Boolean**| Optional, increases frequency of data points for the total value and contribution charts if set to true | [optional] | +| **frequency** | **String**| Optional frequency for the rate of return chart (defaults to monthly). Possible values are daily, weekly, monthly, quarterly, yearly. | [optional] | + +### Return type + +[**PerformanceCustom**](PerformanceCustom.md) + +### Authorization + +[PartnerClientId](../README.md#PartnerClientId), [PartnerSignature](../README.md#PartnerSignature), [PartnerTimestamp](../README.md#PartnerTimestamp) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successfully retrieved performance data | - | +| **0** | Unexpected error | - | + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/TransactionsStatus.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/TransactionsStatus.md new file mode 100644 index 0000000000..8135dc4ef1 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/TransactionsStatus.md @@ -0,0 +1,16 @@ + + +# TransactionsStatus + +Status of account transaction sync + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**initialSyncCompleted** | **Boolean** | | [optional] | +|**lastSuccessfulSync** | **LocalDate** | Date in YYYY-MM-DD format or null | [optional] | +|**firstTransactionDate** | **LocalDate** | Date in YYYY-MM-DD format or null | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/USExchange.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/USExchange.md new file mode 100644 index 0000000000..77217ff824 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/USExchange.md @@ -0,0 +1,22 @@ + + +# USExchange + +US Stock Exchange + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **UUID** | | [optional] | +|**code** | **String** | | [optional] | +|**micCode** | **String** | | [optional] | +|**name** | **String** | | [optional] | +|**timezone** | **String** | | [optional] | +|**startTime** | **String** | | [optional] | +|**closeTime** | **String** | | [optional] | +|**suffix** | **String** | | [optional] | +|**allowsCryptocurrencySymbols** | **Boolean** | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/UnderlyingSymbol.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/UnderlyingSymbol.md new file mode 100644 index 0000000000..174681797c --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/UnderlyingSymbol.md @@ -0,0 +1,22 @@ + + +# UnderlyingSymbol + +Underlying Symbol + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **UUID** | | [optional] | +|**symbol** | **String** | | [optional] | +|**description** | **String** | | [optional] | +|**currency** | [**Currency**](Currency.md) | | [optional] | +|**exchange** | [**USExchange**](USExchange.md) | | [optional] | +|**type** | [**SecurityType**](SecurityType.md) | | [optional] | +|**currencies** | [**List<Currency>**](Currency.md) | | [optional] | +|**figiCode** | **String** | | [optional] | +|**figiInstrument** | [**FigiInstrumentNullable**](FigiInstrumentNullable.md) | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/UniversalActivity.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/UniversalActivity.md new file mode 100644 index 0000000000..5f3e964e1c --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/UniversalActivity.md @@ -0,0 +1,30 @@ + + +# UniversalActivity + +A transaction or activity from an institution + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **String** | | [optional] | +|**account** | [**AccountSimple**](AccountSimple.md) | | [optional] | +|**amount** | **Double** | | [optional] | +|**currency** | [**Currency**](Currency.md) | | [optional] | +|**description** | **String** | | [optional] | +|**fee** | **Double** | | [optional] | +|**fxRate** | **Double** | The forex conversion rate involved in the transaction if provided by the brokerage. Used in cases where securities of one currency are purchased in a different currency, and the forex conversion is automatic. In those cases, price, amount and fee will be in the top level currency (activity -> currency) | [optional] | +|**institution** | **String** | | [optional] | +|**optionType** | **String** | If an option transaction, then it's type (BUY_TO_OPEN, SELL_TO_CLOSE, etc), otherwise empty string | [optional] | +|**price** | **Double** | | [optional] | +|**settlementDate** | **String** | | [optional] | +|**externalReferenceId** | **String** | Reference ID from brokerage used to identify related transactions. For example if an order comprises of several transactions (buy, fee, fx), they can be grouped if they share the same external_reference_id | [optional] | +|**symbol** | [**Symbol**](Symbol.md) | | [optional] | +|**optionSymbol** | [**OptionsSymbol**](OptionsSymbol.md) | | [optional] | +|**tradeDate** | **String** | | [optional] | +|**type** | **String** | Potential values include (but are not limited to) - DIVIDEND - BUY - SELL - CONTRIBUTION - WITHDRAWAL - EXTERNAL_ASSET_TRANSFER_IN - EXTERNAL_ASSET_TRANSFER_OUT - INTERNAL_CASH_TRANSFER_IN - INTERNAL_CASH_TRANSFER_OUT - INTERNAL_ASSET_TRANSFER_IN - INTERNAL_ASSET_TRANSFER_OUT - INTEREST - REBATE - GOV_GRANT - TAX - FEE - REI - FXT | [optional] | +|**units** | **Double** | Usually but not necessarily an integer | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/UniversalSymbol.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/UniversalSymbol.md new file mode 100644 index 0000000000..7ff9cc1c6c --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/UniversalSymbol.md @@ -0,0 +1,23 @@ + + +# UniversalSymbol + +Universal symbol + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **UUID** | | | +|**symbol** | **String** | | | +|**rawSymbol** | **String** | | | +|**description** | **String** | | [optional] | +|**currency** | [**Currency**](Currency.md) | | | +|**exchange** | [**Exchange**](Exchange.md) | | [optional] | +|**type** | [**SecurityType**](SecurityType.md) | | | +|**currencies** | [**List<Currency>**](Currency.md) | | | +|**figiCode** | **String** | | [optional] | +|**figiInstrument** | [**FigiInstrumentNullable**](FigiInstrumentNullable.md) | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/UniversalSymbolNullable.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/UniversalSymbolNullable.md new file mode 100644 index 0000000000..5ef0757867 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/UniversalSymbolNullable.md @@ -0,0 +1,23 @@ + + +# UniversalSymbolNullable + +Universal symbol + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **UUID** | | | +|**symbol** | **String** | | | +|**rawSymbol** | **String** | | | +|**description** | **String** | | [optional] | +|**currency** | [**Currency**](Currency.md) | | | +|**exchange** | [**Exchange**](Exchange.md) | | [optional] | +|**type** | [**SecurityType**](SecurityType.md) | | | +|**currencies** | [**List<Currency>**](Currency.md) | | | +|**figiCode** | **String** | | [optional] | +|**figiInstrument** | [**FigiInstrumentNullable**](FigiInstrumentNullable.md) | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/UserErrorLog.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/UserErrorLog.md new file mode 100644 index 0000000000..f88859977a --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/UserErrorLog.md @@ -0,0 +1,19 @@ + + +# UserErrorLog + +An API error log for a specific SnapTrade user. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**requestedAt** | **String** | | [optional] | +|**response** | **String** | | [optional] | +|**statusCode** | **Double** | | [optional] | +|**queryParams** | **String** | | [optional] | +|**httpMethod** | **String** | | [optional] | +|**endpoint** | **String** | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/UserIDandSecret.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/UserIDandSecret.md new file mode 100644 index 0000000000..858a5a41b2 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/UserIDandSecret.md @@ -0,0 +1,15 @@ + + +# UserIDandSecret + +Response when register user is successful + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**userId** | **String** | SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable. | [optional] | +|**userSecret** | **String** | SnapTrade User Secret randomly generated by SnapTrade. This is privileged information and if compromised, should be rotated via the SnapTrade API. | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/UserSettings.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/UserSettings.md new file mode 100644 index 0000000000..dfbedd388e --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/UserSettings.md @@ -0,0 +1,23 @@ + + +# UserSettings + +User account settings + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**email** | **String** | | [optional] | +|**name** | **String** | | [optional] | +|**receiveCashNotification** | **Boolean** | | [optional] | +|**receiveDriftNotification** | **Boolean** | | [optional] | +|**userTrialActivated** | **Boolean** | | [optional] | +|**activatedTrialDate** | **String** | | [optional] | +|**demo** | **Boolean** | | [optional] | +|**apiEnabled** | **Boolean** | | [optional] | +|**driftThreshold** | **Double** | | [optional] | +|**preferredCurrency** | [**Currency**](Currency.md) | | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ValidatedTradeBody.md b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ValidatedTradeBody.md new file mode 100644 index 0000000000..45516476de --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/docs/ValidatedTradeBody.md @@ -0,0 +1,14 @@ + + +# ValidatedTradeBody + +Validated Trade Form + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**waitToConfirm** | **Boolean** | Optional, defaults to true. Determines if a wait is performed to check on order status. If false, latency will be reduced but orders returned will be more likely to be of status PENDING as we will not wait to check on the status before responding to the request | [optional] | + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/gradle.properties b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/gradle.properties new file mode 100644 index 0000000000..8e73bc59b8 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/gradle.properties @@ -0,0 +1,6 @@ +# This file is automatically generated by Konfig (https://konfigthis.com). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/gradle/wrapper/gradle-wrapper.jar b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000..7454180f2a Binary files /dev/null and b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/gradle/wrapper/gradle-wrapper.jar differ diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/gradle/wrapper/gradle-wrapper.properties b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000..ffed3a254e --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/gradlew b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/gradlew new file mode 100644 index 0000000000..005bcde042 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/gradlew @@ -0,0 +1,234 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${0##*/} + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/gradlew.bat b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/gradlew.bat new file mode 100644 index 0000000000..6a68175eb7 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/header.png b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/header.png new file mode 100644 index 0000000000..ce9f5e1d65 Binary files /dev/null and b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/header.png differ diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/pom.xml b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/pom.xml new file mode 100644 index 0000000000..7e13d90236 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/pom.xml @@ -0,0 +1,368 @@ + + 4.0.0 + com.konfigthis + snaptrade-java-sdk + jar + snaptrade-java-sdk + 5.0.30 + https://github.com/passiv/snaptrade-sdks/tree/master/sdks/java + This library was generated by https://konfigthis.com + + + https://github.com/passiv/snaptrade-sdks/tree/master/sdks/java + + + + + Konfig + engineering@konfigthis.com + Konfig + Konfig + + + + + + MIT + https://opensource.org/licenses/MIT + repo + + + + + + ossrh + https://s01.oss.sonatype.org/content/repositories/snapshots + + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + ${gpg.keyname} + ${gpg.keyname} + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.7 + true + + ossrh + https://s01.oss.sonatype.org/ + true + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + true + 128m + 512m + + -Xlint:all + -J-Xss4m + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.1.0 + + + enforce-maven + + enforce + + + + + 2.2.0 + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + + + loggerPath + conf/log4j.properties + + + -Xms512m -Xmx1500m + methods + 10 + + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + + + + + maven-dependency-plugin + 3.3.0 + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + + test-jar + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.3.0 + + + add_sources + generate-sources + + add-source + + + + src/main/java + + + + + add_test_sources + generate-test-sources + + add-test-source + + + + src/test/java + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.4.1 + + + attach-javadocs + + jar + + + + + none + + + http.response.details + a + Http Response Details: + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.2.1 + + + attach-sources + + jar-no-fork + + + + + + + com.diffplug.spotless + spotless-maven-plugin + ${spotless.version} + + + + + + + .gitignore + + + + + + true + 4 + + + + + + + + + + 1.8 + + true + + + + + + + + + + + + + + io.swagger + swagger-annotations + ${swagger-core-version} + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + com.squareup.okhttp3 + okhttp + ${okhttp-version} + + + com.squareup.okhttp3 + logging-interceptor + ${okhttp-version} + + + com.google.code.gson + gson + ${gson-version} + + + io.gsonfire + gson-fire + ${gson-fire-version} + + + org.apache.commons + commons-lang3 + ${commons-lang3-version} + + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation-version} + provided + + + org.openapitools + jackson-databind-nullable + ${jackson-databind-nullable-version} + + + javax.ws.rs + jsr311-api + ${jsr311-api-version} + + + javax.ws.rs + javax.ws.rs-api + ${javax.ws.rs-api-version} + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + test + + + org.junit.platform + junit-platform-runner + ${junit-platform-runner.version} + test + + + org.mockito + mockito-core + ${mockito-core-version} + test + + + + 1.8 + ${java.version} + ${java.version} + 1.8.5 + 1.6.5 + 4.10.0 + 2.9.1 + 3.12.0 + 0.2.4 + 1.3.5 + 5.9.1 + 1.9.1 + 3.12.4 + 2.1.1 + 1.1.1 + UTF-8 + 2.27.2 + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/settings.gradle b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/settings.gradle new file mode 100644 index 0000000000..a1f48d7561 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "snaptrade-java-sdk" \ No newline at end of file diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/AndroidManifest.xml b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..19fbf001a1 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/AndroidManifest.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/ApiCallback.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/ApiCallback.java new file mode 100644 index 0000000000..7edbefed7c --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/ApiCallback.java @@ -0,0 +1,65 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client; + +import java.io.IOException; + +import java.util.Map; +import java.util.List; + +/** + * Callback for asynchronous API call. + * + * @param The return type + */ +public interface ApiCallback { + /** + * This is called when the API call fails. + * + * @param e The exception causing the failure + * @param statusCode Status code of the response if available, otherwise it would be 0 + * @param responseHeaders Headers of the response if available, otherwise it would be null + */ + void onFailure(ApiException e, int statusCode, Map> responseHeaders); + + /** + * This is called when the API call succeeded. + * + * @param result The result deserialized from response + * @param statusCode Status code of the response + * @param responseHeaders Headers of the response + */ + void onSuccess(T result, int statusCode, Map> responseHeaders); + + /** + * This is called when the API upload processing. + * + * @param bytesWritten bytes Written + * @param contentLength content length of request body + * @param done write end + */ + default void onUploadProgress(long bytesWritten, long contentLength, boolean done) { + return; + } + + /** + * This is called when the API download processing. + * + * @param bytesRead bytes Read + * @param contentLength content length of the response + * @param done Read end + */ + default void onDownloadProgress(long bytesRead, long contentLength, boolean done) { + return; + } +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/ApiClient.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/ApiClient.java new file mode 100644 index 0000000000..09256f2b34 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/ApiClient.java @@ -0,0 +1,1520 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + +package com.konfigthis.client; + +import okhttp3.*; +import okhttp3.internal.http.HttpMethod; +import okhttp3.internal.tls.OkHostnameVerifier; +import okhttp3.logging.HttpLoggingInterceptor; +import okhttp3.logging.HttpLoggingInterceptor.Level; +import okio.Buffer; +import okio.BufferedSink; +import okio.Okio; + +import javax.net.ssl.*; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Type; +import java.net.URI; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.SecureRandom; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.text.DateFormat; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.Map.Entry; +import java.util.concurrent.TimeUnit; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import com.konfigthis.client.auth.Authentication; +import com.konfigthis.client.auth.HttpBasicAuth; +import com.konfigthis.client.auth.HttpBearerAuth; +import com.konfigthis.client.auth.ApiKeyAuth; + +/** + *

ApiClient class.

+ */ +public class ApiClient extends ApiClientCustom { + + private String basePath = "https://api.snaptrade.com/api/v1"; + private boolean debugging = false; + private Map defaultHeaderMap = new HashMap(); + private Map defaultCookieMap = new HashMap(); + private String tempFolderPath = null; + + private Map authentications; + + private DateFormat dateFormat; + private DateFormat datetimeFormat; + private boolean lenientDatetimeFormat; + private int dateLength; + + private InputStream sslCaCert; + private boolean verifyingSsl; + private KeyManager[] keyManagers; + + private OkHttpClient httpClient; + private JSON json; + + private HttpLoggingInterceptor loggingInterceptor; + + public String consumerKey; + + /** + * Basic constructor for ApiClient + */ + public ApiClient() { + this((OkHttpClient) null, null); + } + + /** + * Basic constructor with custom OkHttpClient + * + * @param client a {@link okhttp3.OkHttpClient} object + */ + public ApiClient(OkHttpClient client) { + this(client, null); + } + + public ApiClient(OkHttpClient client, Configuration configuration) { + init(); + if (configuration != null) { + // Setting up authentications, if applicable, may rely on the following, so we initialize them first + setBasePath(configuration.host); + } + // Setup authentications (key: authentication name, value: authentication). + authentications.put("PartnerClientId", new ApiKeyAuth("query", "clientId")); + authentications.put("PartnerSignature", new ApiKeyAuth("header", "Signature")); + authentications.put("PartnerTimestamp", new ApiKeyAuth("query", "timestamp")); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + + if (client == null) { + initHttpClient(); + } else { + this.httpClient = client; + } + + if (configuration != null) { + if (configuration.clientId != null) { + this.setPartnerClientId(configuration.clientId); + } + if (configuration.Signature != null) { + this.setPartnerSignature(configuration.Signature); + } + if (configuration.timestamp != null) { + this.setPartnerTimestamp(configuration.timestamp); + } + if (configuration.consumerKey != null) { + this.consumerKey = configuration.consumerKey; + } + setVerifyingSsl(configuration.verifyingSsl); + } + } + + public String getPartnerClientId() { + return ((ApiKeyAuth) this.getAuthentication("PartnerClientId")).getApiKey(); + } + + public void setPartnerClientId(String apiKey) { + ((ApiKeyAuth) this.getAuthentication("PartnerClientId")).setApiKey(apiKey); + } + + public void setPartnerClientIdPrefix(String prefix) { + ((ApiKeyAuth) this.getAuthentication("PartnerClientId")).setApiKeyPrefix(prefix); + } + public String getPartnerSignature() { + return ((ApiKeyAuth) this.getAuthentication("PartnerSignature")).getApiKey(); + } + + public void setPartnerSignature(String apiKey) { + ((ApiKeyAuth) this.getAuthentication("PartnerSignature")).setApiKey(apiKey); + } + + public void setPartnerSignaturePrefix(String prefix) { + ((ApiKeyAuth) this.getAuthentication("PartnerSignature")).setApiKeyPrefix(prefix); + } + public String getPartnerTimestamp() { + return ((ApiKeyAuth) this.getAuthentication("PartnerTimestamp")).getApiKey(); + } + + public void setPartnerTimestamp(String apiKey) { + ((ApiKeyAuth) this.getAuthentication("PartnerTimestamp")).setApiKey(apiKey); + } + + public void setPartnerTimestampPrefix(String prefix) { + ((ApiKeyAuth) this.getAuthentication("PartnerTimestamp")).setApiKeyPrefix(prefix); + } + private void initHttpClient() { + initHttpClient(Collections.emptyList()); + } + + private void initHttpClient(List interceptors) { + OkHttpClient.Builder builder = new OkHttpClient.Builder(); + builder.addNetworkInterceptor(getProgressInterceptor()); + for (Interceptor interceptor: interceptors) { + builder.addInterceptor(interceptor); + } + builder.readTimeout(0, TimeUnit.MILLISECONDS); + + httpClient = builder.build(); + } + + private void init() { + verifyingSsl = true; + + json = new JSON(); + + // Set default User-Agent. + setUserAgent("Konfig/5.0.30/java"); + + authentications = new HashMap(); + } + + /** + * Get base path + * + * @return Base path + */ + public String getBasePath() { + return basePath; + } + + /** + * Set base path + * + * @param basePath Base path of the URL (e.g https://api.snaptrade.com/api/v1) + * @return An instance of OkHttpClient + */ + public ApiClient setBasePath(String basePath) { + // strip trailing slash from basePath + if (basePath != null && basePath.endsWith("/")) { + basePath = basePath.substring(0, basePath.length() - 1); + } + this.basePath = basePath; + return this; + } + + + /** + * Get HTTP client + * + * @return An instance of OkHttpClient + */ + public OkHttpClient getHttpClient() { + return httpClient; + } + + /** + * Set HTTP client, which must never be null. + * + * @param newHttpClient An instance of OkHttpClient + * @return Api Client + * @throws java.lang.NullPointerException when newHttpClient is null + */ + public ApiClient setHttpClient(OkHttpClient newHttpClient) { + this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); + return this; + } + + /** + * Get JSON + * + * @return JSON object + */ + public JSON getJSON() { + return json; + } + + /** + * Set JSON + * + * @param json JSON object + * @return Api client + */ + public ApiClient setJSON(JSON json) { + this.json = json; + return this; + } + + /** + * True if isVerifyingSsl flag is on + * + * @return True if isVerifySsl flag is on + */ + public boolean isVerifyingSsl() { + return verifyingSsl; + } + + /** + * Configure whether to verify certificate and hostname when making https requests. + * Default to true. + * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. + * + * @param verifyingSsl True to verify TLS/SSL connection + * @return ApiClient + */ + public ApiClient setVerifyingSsl(boolean verifyingSsl) { + this.verifyingSsl = verifyingSsl; + applySslSettings(); + return this; + } + + /** + * Get SSL CA cert. + * + * @return Input stream to the SSL CA cert + */ + public InputStream getSslCaCert() { + return sslCaCert; + } + + /** + * Configure the CA certificate to be trusted when making https requests. + * Use null to reset to default. + * + * @param sslCaCert input stream for SSL CA cert + * @return ApiClient + */ + public ApiClient setSslCaCert(InputStream sslCaCert) { + this.sslCaCert = sslCaCert; + applySslSettings(); + return this; + } + + /** + *

Getter for the field keyManagers.

+ * + * @return an array of {@link javax.net.ssl.KeyManager} objects + */ + public KeyManager[] getKeyManagers() { + return keyManagers; + } + + /** + * Configure client keys to use for authorization in an SSL session. + * Use null to reset to default. + * + * @param managers The KeyManagers to use + * @return ApiClient + */ + public ApiClient setKeyManagers(KeyManager[] managers) { + this.keyManagers = managers; + applySslSettings(); + return this; + } + + /** + *

Getter for the field dateFormat.

+ * + * @return a {@link java.text.DateFormat} object + */ + public DateFormat getDateFormat() { + return dateFormat; + } + + /** + *

Setter for the field dateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link com.konfigthis.client.ApiClient} object + */ + public ApiClient setDateFormat(DateFormat dateFormat) { + JSON.setDateFormat(dateFormat); + return this; + } + + /** + *

Set SqlDateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link com.konfigthis.client.ApiClient} object + */ + public ApiClient setSqlDateFormat(DateFormat dateFormat) { + JSON.setSqlDateFormat(dateFormat); + return this; + } + + /** + *

Set OffsetDateTimeFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link com.konfigthis.client.ApiClient} object + */ + public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + JSON.setOffsetDateTimeFormat(dateFormat); + return this; + } + + /** + *

Set LocalDateFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link com.konfigthis.client.ApiClient} object + */ + public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { + JSON.setLocalDateFormat(dateFormat); + return this; + } + + /** + *

Set LenientOnJson.

+ * + * @param lenientOnJson a boolean + * @return a {@link com.konfigthis.client.ApiClient} object + */ + public ApiClient setLenientOnJson(boolean lenientOnJson) { + JSON.setLenientOnJson(lenientOnJson); + return this; + } + + /** + * Get authentications (key: authentication name, value: authentication). + * + * @return Map of authentication objects + */ + public Map getAuthentications() { + return authentications; + } + + /** + * Get authentication for the given name. + * + * @param authName The authentication name + * @return The authentication, null if not found + */ + public Authentication getAuthentication(String authName) { + return authentications.get(authName); + } + + + /** + * Helper method to set username for the first HTTP basic authentication. + * + * @param username Username + */ + public void setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * + * @param password Password + */ + public void setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + + /** + * Set the User-Agent header's value (by adding to the default header map). + * + * @param userAgent HTTP request's user agent + * @return ApiClient + */ + public ApiClient setUserAgent(String userAgent) { + addDefaultHeader("User-Agent", userAgent); + return this; + } + + /** + * Add a default header. + * + * @param key The header's key + * @param value The header's value + * @return ApiClient + */ + public ApiClient addDefaultHeader(String key, String value) { + defaultHeaderMap.put(key, value); + return this; + } + + /** + * Add a default cookie. + * + * @param key The cookie's key + * @param value The cookie's value + * @return ApiClient + */ + public ApiClient addDefaultCookie(String key, String value) { + defaultCookieMap.put(key, value); + return this; + } + + /** + * Check that whether debugging is enabled for this API client. + * + * @return True if debugging is enabled, false otherwise. + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return ApiClient + */ + public ApiClient setDebugging(boolean debugging) { + if (debugging != this.debugging) { + if (debugging) { + loggingInterceptor = new HttpLoggingInterceptor(); + loggingInterceptor.setLevel(Level.BODY); + httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); + } else { + final OkHttpClient.Builder builder = httpClient.newBuilder(); + builder.interceptors().remove(loggingInterceptor); + httpClient = builder.build(); + loggingInterceptor = null; + } + } + this.debugging = debugging; + return this; + } + + /** + * The path of temporary folder used to store downloaded files from endpoints + * with file response. The default value is null, i.e. using + * the system's default temporary folder. + * + * @see createTempFile + * @return Temporary folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set the temporary folder path (for downloading files) + * + * @param tempFolderPath Temporary folder path + * @return ApiClient + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getConnectTimeout() { + return httpClient.connectTimeoutMillis(); + } + + /** + * Sets the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param connectionTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get read timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getReadTimeout() { + return httpClient.readTimeoutMillis(); + } + + /** + * Sets the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param readTimeout read timeout in milliseconds + * @return Api client + */ + public ApiClient setReadTimeout(int readTimeout) { + httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get write timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getWriteTimeout() { + return httpClient.writeTimeoutMillis(); + } + + /** + * Sets the write timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param writeTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setWriteTimeout(int writeTimeout) { + httpClient = httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + + /** + * Format the given parameter object into string. + * + * @param param Parameter + * @return String representation of the parameter + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date || param instanceof OffsetDateTime || param instanceof LocalDate) { + //Serialize to json string and remove the " enclosing characters + String jsonStr = JSON.serialize(param); + return jsonStr.substring(1, jsonStr.length() - 1); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for (Object o : (Collection) param) { + if (b.length() > 0) { + b.append(","); + } + b.append(o); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /** + * Formats the specified query parameter to a list containing a single {@code Pair} object. + * + * Note that {@code value} must not be a collection. + * + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list containing a single {@code Pair} object. + */ + public List parameterToPair(String name, Object value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value instanceof Collection) { + return params; + } + + params.add(new Pair(name, parameterToString(value))); + return params; + } + + /** + * Formats the specified collection query parameters to a list of {@code Pair} objects. + * + * Note that the values of each of the returned Pair objects are percent-encoded. + * + * @param collectionFormat The collection format of the parameter. + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list of {@code Pair} objects. + */ + public List parameterToPairs(String collectionFormat, String name, Collection value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value.isEmpty()) { + return params; + } + + // create the params based on the collection format + if ("multi".equals(collectionFormat)) { + for (Object item : value) { + params.add(new Pair(name, escapeString(parameterToString(item)))); + } + return params; + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + // escape all delimiters except commas, which are URI reserved + // characters + if ("ssv".equals(collectionFormat)) { + delimiter = escapeString(" "); + } else if ("tsv".equals(collectionFormat)) { + delimiter = escapeString("\t"); + } else if ("pipes".equals(collectionFormat)) { + delimiter = escapeString("|"); + } + + StringBuilder sb = new StringBuilder(); + for (Object item : value) { + sb.append(delimiter); + sb.append(escapeString(parameterToString(item))); + } + + params.add(new Pair(name, sb.substring(delimiter.length()))); + + return params; + } + + /** + * Formats the specified collection path parameter to a string value. + * + * @param collectionFormat The collection format of the parameter. + * @param value The value of the parameter. + * @return String representation of the parameter + */ + public String collectionPathParameterToString(String collectionFormat, Collection value) { + // create the value based on the collection format + if ("multi".equals(collectionFormat)) { + // not valid for path params + return parameterToString(value); + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + if ("ssv".equals(collectionFormat)) { + delimiter = " "; + } else if ("tsv".equals(collectionFormat)) { + delimiter = "\t"; + } else if ("pipes".equals(collectionFormat)) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : value) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + return sb.substring(delimiter.length()); + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param filename The filename to be sanitized + * @return The sanitized filename + */ + public String sanitizeFilename(String filename) { + return filename.replaceAll(".*[/\\\\]", ""); + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * "* / *" is also default to JSON + * @param mime MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + public boolean isJsonMime(String mime) { + String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; + return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); + } + + /** + * Select the Accept header's value from the given accepts array: + * if JSON exists in the given array, use it; + * otherwise use all of them (joining into a string) + * + * @param accepts The accepts array to select from + * @return The Accept header to use. If the given array is empty, + * null will be returned (not to set the Accept header explicitly). + */ + public String selectHeaderAccept(String[] accepts) { + if (accepts.length == 0) { + return null; + } + for (String accept : accepts) { + if (isJsonMime(accept)) { + return accept; + } + } + return StringUtil.join(accepts, ","); + } + + /** + * Select the Content-Type header's value from the given array: + * if JSON exists in the given array, use it; + * otherwise use the first one of the array. + * + * @param contentTypes The Content-Type array to select from + * @return The Content-Type header to use. If the given array is empty, + * returns null. If it matches "any", JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) { + return null; + } + + if (contentTypes[0].equals("*/*")) { + return "application/json"; + } + + for (String contentType : contentTypes) { + if (isJsonMime(contentType)) { + return contentType; + } + } + + return contentTypes[0]; + } + + /** + * Escape the given string to be used as URL query value. + * + * @param str String to be escaped + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Deserialize response body to Java object, according to the return type and + * the Content-Type response header. + * + * @param Type + * @param response HTTP response + * @param returnType The type of the Java object + * @return The deserialized Java object + * @throws com.konfigthis.client.ApiException If fail to deserialize response body, i.e. cannot read response body + * or the Content-Type of the response is not supported. + */ + @SuppressWarnings("unchecked") + public T deserialize(Response response, Type returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + try { + return (T) response.body().bytes(); + } catch (IOException e) { + throw new ApiException(e); + } + } else if (returnType.equals(File.class)) { + // Handle file downloading. + return (T) downloadFileFromResponse(response); + } + + String respBody; + try { + if (response.body() != null) + respBody = response.body().string(); + else + respBody = null; + } catch (IOException e) { + throw new ApiException(e); + } + + if (respBody == null || "".equals(respBody)) { + return null; + } + + String contentType = response.headers().get("Content-Type"); + if (contentType == null) { + // ensuring a default content type + contentType = "application/json"; + } + if (isJsonMime(contentType)) { + return JSON.deserialize(respBody, returnType); + } else if (returnType.equals(String.class)) { + // Expecting string, return the raw response body. + return (T) respBody; + } else { + throw new ApiException( + "Content type \"" + contentType + "\" is not supported for type: " + returnType, + response.code(), + response.headers().toMultimap(), + respBody, response.receivedResponseAtMillis() - response.sentRequestAtMillis()); + } + } + + /** + * Serialize the given Java object into request body according to the object's + * class and the request Content-Type. + * + * @param obj The Java object + * @param contentType The request Content-Type + * @return The serialized request body + * @throws com.konfigthis.client.ApiException If fail to serialize the given object + */ + public RequestBody serialize(Object obj, String contentType) throws ApiException { + if (obj instanceof byte[]) { + // Binary (byte array) body parameter support. + return RequestBody.create((byte[]) obj, MediaType.parse(contentType)); + } else if (obj instanceof File) { + // File body parameter support. + return RequestBody.create((File) obj, MediaType.parse(contentType)); + } else if ("text/plain".equals(contentType) && obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else if (isJsonMime(contentType)) { + String content; + if (obj != null) { + content = JSON.serialize(obj); + } else { + content = null; + } + return RequestBody.create(content, MediaType.parse(contentType)); + } else if (obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else { + throw new ApiException("Content type \"" + contentType + "\" is not supported"); + } + } + + /** + * Download file from the given response. + * + * @param response An instance of the Response object + * @throws com.konfigthis.client.ApiException If fail to read file content from response and write to disk + * @return Downloaded file + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + BufferedSink sink = Okio.buffer(Okio.sink(file)); + sink.writeAll(response.body().source()); + sink.close(); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Prepare file for download + * + * @param response An instance of the Response object + * @return Prepared file for the download + * @throws java.io.IOException If fail to prepare file for download + */ + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = response.header("Content-Disposition"); + if (contentDisposition != null && !"".equals(contentDisposition)) { + // Get filename from the Content-Disposition header. + Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); + Matcher matcher = pattern.matcher(contentDisposition); + if (matcher.find()) { + filename = sanitizeFilename(matcher.group(1)); + } + } + + String prefix = null; + String suffix = null; + if (filename == null) { + prefix = "download-"; + suffix = ""; + } else { + int pos = filename.lastIndexOf("."); + if (pos == -1) { + prefix = filename + "-"; + } else { + prefix = filename.substring(0, pos) + "-"; + suffix = filename.substring(pos); + } + // Files.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return Files.createTempFile(prefix, suffix).toFile(); + else + return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); + } + + /** + * {@link #execute(Call, Type)} + * + * @param Type + * @param call An instance of the Call object + * @return ApiResponse<T> + * @throws com.konfigthis.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call) throws ApiException { + return execute(call, null); + } + + /** + * Execute HTTP call and deserialize the HTTP response body into the given return type. + * + * @param returnType The return type used to deserialize HTTP response body + * @param The return type corresponding to (same with) returnType + * @param call Call + * @return ApiResponse object containing response status, headers and + * data, which is a Java object deserialized from response body and would be null + * when returnType is null. + * @throws com.konfigthis.client.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call, Type returnType) throws ApiException { + try { + Response response = call.execute(); + T data = handleResponse(response, returnType); + return new ApiResponse( + call.request(), + response.code(), + response.headers().toMultimap(), + data, + response.receivedResponseAtMillis() - + response.sentRequestAtMillis()); + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * {@link #executeAsync(Call, Type, ApiCallback)} + * + * @param Type + * @param call An instance of the Call object + * @param callback ApiCallback<T> + */ + public void executeAsync(Call call, ApiCallback callback) { + executeAsync(call, null, callback); + } + + /** + * Execute HTTP call asynchronously. + * + * @param Type + * @param call The callback to be executed when the API call finishes + * @param returnType Return type + * @param callback ApiCallback + * @see #execute(Call, Type) + */ + @SuppressWarnings("unchecked") + public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, IOException e) { + callback.onFailure(new ApiException(e), 0, null); + } + + @Override + public void onResponse(Call call, Response response) throws IOException { + T result; + try { + result = (T) handleResponse(response, returnType); + } catch (ApiException e) { + callback.onFailure(e, response.code(), response.headers().toMultimap()); + return; + } catch (Exception e) { + callback.onFailure(new ApiException(e), response.code(), response.headers().toMultimap()); + return; + } + callback.onSuccess(result, response.code(), response.headers().toMultimap()); + } + }); + } + + /** + * Handle the given response, return the deserialized object when the response is successful. + * + * @param Type + * @param response Response + * @param returnType Return type + * @return Type + * @throws com.konfigthis.client.ApiException If the response has an unsuccessful status code or + * fail to deserialize the response body + */ + public T handleResponse(Response response, Type returnType) throws ApiException { + if (response.isSuccessful()) { + if (returnType == null || response.code() == 204) { + // returning null if the returnType is not defined, + // or the status code is 204 (No Content) + if (response.body() != null) { + try { + response.body().close(); + } catch (Exception e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap(), response.receivedResponseAtMillis() - response.sentRequestAtMillis()); + } + } + return null; + } else { + return deserialize(response, returnType); + } + } else { + String respBody = null; + if (response.body() != null) { + try { + respBody = response.body().string(); + } catch (IOException e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap(), response.receivedResponseAtMillis() - response.sentRequestAtMillis()); + } + } + throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody, response.receivedResponseAtMillis() - response.sentRequestAtMillis()); + } + } + + /** + * Build HTTP call with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP call + * @throws com.konfigthis.client.ApiException If fail to serialize the request body object + */ + public Call buildCall(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + Request request = buildRequest(baseUrl, path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); + + return httpClient.newCall(request); + } + + /** + * Build an HTTP request with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP request + * @throws com.konfigthis.client.ApiException If fail to serialize the request body object + */ + public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + requestBeforeHook(baseUrl, path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, this); + + // prepare HTTP request body + RequestBody reqBody; + String contentType = headerParams.get("Content-Type"); + + if (!HttpMethod.permitsRequestBody(method)) { + reqBody = null; + } else if ("application/x-www-form-urlencoded".equals(contentType)) { + reqBody = buildRequestBodyFormEncoding(formParams); + } else if ("multipart/form-data".equals(contentType)) { + reqBody = buildRequestBodyMultipart(formParams); + } else if (body == null) { + if ("DELETE".equals(method)) { + // allow calling DELETE without sending a request body + reqBody = null; + } else { + // use an empty request body (for POST, PUT and PATCH) + reqBody = RequestBody.create("", contentType == null ? null : MediaType.parse(contentType)); + } + } else { + reqBody = serialize(body, contentType); + } + + String payload = requestBodyToString(reqBody); + + // update parameters with authentication settings + updateParamsForAuth(authNames, queryParams, headerParams, cookieParams, payload, method); + + final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); + + requestAfterHook(url, path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, payload, this); + + final Request.Builder reqBuilder = new Request.Builder().url(url); + processHeaderParams(headerParams, reqBuilder); + processCookieParams(cookieParams, reqBuilder); + + // Associate callback with request (if not null) so interceptor can + // access it when creating ProgressResponseBody + reqBuilder.tag(callback); + + Request request = null; + + if (callback != null && reqBody != null) { + ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, callback); + request = reqBuilder.method(method, progressRequestBody).build(); + } else { + request = reqBuilder.method(method, reqBody).build(); + } + + return request; + } + + /** + * Build full URL by concatenating base path, the given sub path and query parameters. + * + * @param baseUrl The base URL + * @param path The sub path + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @return The full URL + */ + public String buildUrl(String baseUrl, String path, List queryParams, List collectionQueryParams) { + final StringBuilder url = new StringBuilder(); + if (baseUrl != null) { + url.append(baseUrl).append(path); + } else { + url.append(basePath).append(path); + } + + if (queryParams != null && !queryParams.isEmpty()) { + // support (constant) query string in `path`, e.g. "/posts?draft=1" + String prefix = path.contains("?") ? "&" : "?"; + for (Pair param : queryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + url.append(escapeString(param.getName())).append("=").append(escapeString(value)); + } + } + } + + if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { + String prefix = url.toString().contains("?") ? "&" : "?"; + for (Pair param : collectionQueryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + // collection query parameter value already escaped as part of parameterToPairs + url.append(escapeString(param.getName())).append("=").append(value); + } + } + } + + return url.toString(); + } + + /** + * Set header parameters to the request builder, including default headers. + * + * @param headerParams Header parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { + for (Entry param : headerParams.entrySet()) { + reqBuilder.header(param.getKey(), parameterToString(param.getValue())); + } + for (Entry header : defaultHeaderMap.entrySet()) { + if (!headerParams.containsKey(header.getKey())) { + reqBuilder.header(header.getKey(), parameterToString(header.getValue())); + } + } + } + + /** + * Set cookie parameters to the request builder, including default cookies. + * + * @param cookieParams Cookie parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processCookieParams(Map cookieParams, Request.Builder reqBuilder) { + for (Entry param : cookieParams.entrySet()) { + reqBuilder.addHeader("Cookie", String.format("%s=%s", param.getKey(), param.getValue())); + } + for (Entry param : defaultCookieMap.entrySet()) { + if (!cookieParams.containsKey(param.getKey())) { + reqBuilder.addHeader("Cookie", String.format("%s=%s", param.getKey(), param.getValue())); + } + } + } + + /** + * Update query and header parameters based on authentication settings. + * + * @param authNames The authentications to apply + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + * @param cookieParams Map of cookie parameters + * @param payload HTTP request body + * @param method HTTP method + * @throws com.konfigthis.client.ApiException If fails to update the parameters + */ + public void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams, + Map cookieParams, String payload, String method) throws ApiException { + for (String authName : authNames) { + Authentication auth = authentications.get(authName); + if (auth == null) { + throw new RuntimeException("Authentication undefined: " + authName); + } + auth.applyToParams(queryParams, headerParams, cookieParams, payload, method); + } + } + + /** + * Build a form-encoding request body with the given form parameters. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyFormEncoding(Map formParams) { + okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); + for (Entry param : formParams.entrySet()) { + formBuilder.add(param.getKey(), parameterToString(param.getValue())); + } + return formBuilder.build(); + } + + /** + * Build a multipart (file uploading) request body with the given form parameters, + * which could contain text fields and file fields. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyMultipart(Map formParams) { + MultipartBody.Builder mpBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM); + for (Entry param : formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + addPartToMultiPartBuilder(mpBuilder, param.getKey(), file); + } else if (param.getValue() instanceof List) { + List list = (List) param.getValue(); + for (Object item: list) { + if (item instanceof File) { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), (File) item); + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + return mpBuilder.build(); + } + + /** + * Guess Content-Type header from the given file (defaults to "application/octet-stream"). + * + * @param file The given file + * @return The guessed Content-Type + */ + public String guessContentTypeFromFile(File file) { + String contentType = URLConnection.guessContentTypeFromName(file.getName()); + if (contentType == null) { + return "application/octet-stream"; + } else { + return contentType; + } + } + + /** + * Add a Content-Disposition Header for the given key and file to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param file The file to add to the Header + */ + private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) { + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\""); + MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); + mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); + } + + /** + * Add a Content-Disposition Header for the given key and complex object to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param obj The complex object to add to the Header + */ + private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) { + RequestBody requestBody; + if (obj instanceof String) { + requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain")); + } else { + String content; + if (obj != null) { + content = JSON.serialize(obj); + } else { + content = null; + } + requestBody = RequestBody.create(content, MediaType.parse("application/json")); + } + + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\""); + mpBuilder.addPart(partHeaders, requestBody); + } + + /** + * Get network interceptor to add it to the httpClient to track download progress for + * async requests. + */ + private Interceptor getProgressInterceptor() { + return new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + final Request request = chain.request(); + final Response originalResponse = chain.proceed(request); + if (request.tag() instanceof ApiCallback) { + final ApiCallback callback = (ApiCallback) request.tag(); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), callback)) + .build(); + } + return originalResponse; + } + }; + } + + /** + * Apply SSL related settings to httpClient according to the current values of + * verifyingSsl and sslCaCert. + */ + private void applySslSettings() { + try { + TrustManager[] trustManagers; + HostnameVerifier hostnameVerifier; + if (!verifyingSsl) { + trustManagers = new TrustManager[]{ + new X509TrustManager() { + @Override + public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return new java.security.cert.X509Certificate[]{}; + } + } + }; + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }; + } else { + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + + if (sslCaCert == null) { + trustManagerFactory.init((KeyStore) null); + } else { + char[] password = null; // Any password will work. + CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); + Collection certificates = certificateFactory.generateCertificates(sslCaCert); + if (certificates.isEmpty()) { + throw new IllegalArgumentException("expected non-empty set of trusted certificates"); + } + KeyStore caKeyStore = newEmptyKeyStore(password); + int index = 0; + for (Certificate certificate : certificates) { + String certificateAlias = "ca" + (index++); + caKeyStore.setCertificateEntry(certificateAlias, certificate); + } + trustManagerFactory.init(caKeyStore); + } + trustManagers = trustManagerFactory.getTrustManagers(); + hostnameVerifier = OkHostnameVerifier.INSTANCE; + } + + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(keyManagers, trustManagers, new SecureRandom()); + httpClient = httpClient.newBuilder() + .sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0]) + .hostnameVerifier(hostnameVerifier) + .build(); + } catch (GeneralSecurityException e) { + throw new RuntimeException(e); + } + } + + private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { + try { + KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); + keyStore.load(null, password); + return keyStore; + } catch (IOException e) { + throw new AssertionError(e); + } + } + + /** + * Convert the HTTP request body to a string. + * + * @param requestBody The HTTP request object + * @return The string representation of the HTTP request body + * @throws com.konfigthis.client.ApiException If fail to serialize the request body object into a string + */ + private String requestBodyToString(RequestBody requestBody) throws ApiException { + if (requestBody != null) { + try { + final Buffer buffer = new Buffer(); + requestBody.writeTo(buffer); + return buffer.readUtf8(); + } catch (final IOException e) { + throw new ApiException(e); + } + } + + // empty http request body + return ""; + } +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/ApiClientCustom.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/ApiClientCustom.java new file mode 100644 index 0000000000..9822bf76b4 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/ApiClientCustom.java @@ -0,0 +1,59 @@ +package com.konfigthis.client; + +import com.google.gson.Gson; + +import javax.crypto.Mac; +import javax.crypto.spec.SecretKeySpec; +import java.nio.charset.StandardCharsets; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import java.util.Base64; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; + +public class ApiClientCustom { + + protected void requestBeforeHook(String baseUrl, String path, String method, List queryParams, + List collectionQueryParams, Object body, Map headerParams, + Map cookieParams, Map formParams, + String[] authNames, ApiClient client) { + Pair timestamp = new Pair("timestamp", String.valueOf(System.currentTimeMillis() / 1000L)); + queryParams.add(timestamp); + } + + protected void requestAfterHook(String url, String path, String method, List queryParams, + List collectionQueryParams, Object body, Map headerParams, + Map cookieParams, Map formParams, + String[] authNames, String payload, ApiClient client) { + if (client.consumerKey == null) + throw new RuntimeException("Set the consumer key by configuring Configuration#consumerKey"); + Gson gson = JSON.getGson(); + Object map = body instanceof List ? body : gson.fromJson(payload, TreeMap.class); + String sortedJson = map == null ? "\"\"" : gson.toJson(map); + String queryString = url.split("\\?")[1]; + String data = String.format("{\"content\":%s,\"path\":\"/api/v1%s\",\"query\":\"%s\"}", + payload == null || payload.equals("") || payload.equals("{}") ? "null" : sortedJson, path, queryString); + byte[] hmacSha256Bytes; + try { + hmacSha256Bytes = calculateHmacSha256(data, client.consumerKey); + } catch (NoSuchAlgorithmException | InvalidKeyException e) { + throw new RuntimeException(e); + } + String hmacSha256Base64 = encodeBase64(hmacSha256Bytes); + headerParams.put("Signature", hmacSha256Base64); + } + + private static byte[] calculateHmacSha256(String message, String key) + throws NoSuchAlgorithmException, InvalidKeyException { + SecretKeySpec secretKeySpec = new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), "HmacSHA256"); + Mac mac = Mac.getInstance("HmacSHA256"); + mac.init(secretKeySpec); + return mac.doFinal(message.getBytes(StandardCharsets.UTF_8)); + } + + private static String encodeBase64(byte[] bytes) { + return Base64.getEncoder().encodeToString(bytes); + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/ApiException.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/ApiException.java new file mode 100644 index 0000000000..af082815ed --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/ApiException.java @@ -0,0 +1,176 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client; + +import java.util.Map; +import java.util.List; + +import javax.ws.rs.core.GenericType; + +/** + *

ApiException class.

+ */ +@SuppressWarnings("serial") +@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class ApiException extends Exception { + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; + private Long roundTripTime = null; + + /** + *

Constructor for ApiException.

+ */ + public ApiException() {} + + /** + *

Constructor for ApiException.

+ * + * @param throwable a {@link java.lang.Throwable} object + */ + public ApiException(Throwable throwable) { + super(throwable); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + */ + public ApiException(String message) { + super(message); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody, Long roundTripTime) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + this.roundTripTime = roundTripTime; + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, int code, Map> responseHeaders, String responseBody, Long roundTripTime) { + this(message, (Throwable) null, code, responseHeaders, responseBody, roundTripTime); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, Long roundTripTime) { + this(message, throwable, code, responseHeaders, null, roundTripTime); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(int code, Map> responseHeaders, String responseBody) { + this((String) null, (Throwable) null, code, responseHeaders, responseBody, null); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message a {@link java.lang.String} object + */ + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message the error message + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(int code, String message, Map> responseHeaders, String responseBody) { + this(code, message); + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + * Get the HTTP status code. + * + * @return HTTP status code + */ + public int getStatusCode() { + return code; + } + + /** + * Get the HTTP response headers. + * + * @return A map of list of string + */ + public Map> getResponseHeaders() { + return responseHeaders; + } + + /** + * Get the HTTP response body. + * + * @return Response body in the form of string + */ + public String getResponseBody() { + return responseBody; + } + + /** + * Get the round trip time + * + * @return total time between start and end of request + */ + public Long getRoundTripTime() { + return roundTripTime; + } + + /** + * Get the exception message including HTTP response data. + * + * @return The exception message + */ + public String getMessage() { + return String.format("Message: %s%nHTTP response code: %s%nHTTP response body: %s%nHTTP response headers: %s", + super.getMessage(), this.getStatusCode(), this.getResponseBody(), this.getResponseHeaders()); + } +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/ApiResponse.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/ApiResponse.java new file mode 100644 index 0000000000..548eaea080 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/ApiResponse.java @@ -0,0 +1,89 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client; + +import java.util.List; +import java.util.Map; + +import okhttp3.Request; + +/** + * API response returned by API call. + */ +public class ApiResponse { + final private int statusCode; + final private Map> headers; + final private T data; + final private Request request; + final private long roundTripTime; + + /** + *

Constructor for ApiResponse.

+ * + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + * @param data The object deserialized from response bod + */ + public ApiResponse(Request request, int statusCode, Map> headers, T data, long roundTripTime) { + this.request = request; + this.statusCode = statusCode; + this.headers = headers; + this.data = data; + this.roundTripTime = roundTripTime; + } + + /** + *

Get the status code.

+ * + * @return the status code + */ + public int getStatusCode() { + return statusCode; + } + + /** + *

Get the headers.

+ * + * @return a {@link java.util.Map} of headers + */ + public Map> getResponseHeaders() { + return headers; + } + + /** + *

Get the data.

+ * + * @return the data + */ + public T getResponseBody() { + return data; + } + + /** + *

Get the request.

+ * + * @return the request + */ + public Request getRequest() { + return request; + } + + /** + *

Get the roundTripTime.

+ * + * @return the round trip time + */ + public long getRoundTripTime() { + return roundTripTime; + } +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/Configuration.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/Configuration.java new file mode 100644 index 0000000000..7615cab5ee --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/Configuration.java @@ -0,0 +1,44 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client; + +@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class Configuration { + private static ApiClient defaultApiClient = new ApiClient(); + public boolean verifyingSsl = true; + public String host = "https://api.snaptrade.com/api/v1"; + public String clientId; + public String Signature; + public String timestamp; + public String consumerKey; + + /** + * Get the default API client, which would be used when creating API + * instances without providing an API client. + * + * @return Default API client + */ + public static ApiClient getDefaultApiClient() { + return defaultApiClient; + } + + /** + * Set the default API client, which would be used when creating API + * instances without providing an API client. + * + * @param apiClient API client + */ + public static void setDefaultApiClient(ApiClient apiClient) { + defaultApiClient = apiClient; + } +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/GzipRequestInterceptor.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/GzipRequestInterceptor.java new file mode 100644 index 0000000000..24bc026c0e --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/GzipRequestInterceptor.java @@ -0,0 +1,84 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client; + +import okhttp3.*; +import okio.Buffer; +import okio.BufferedSink; +import okio.GzipSink; +import okio.Okio; + +import java.io.IOException; + +/** + * Encodes request bodies using gzip. + * + * Taken from https://github.com/square/okhttp/issues/350 + */ +class GzipRequestInterceptor implements Interceptor { + @Override + public Response intercept(Chain chain) throws IOException { + Request originalRequest = chain.request(); + if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) { + return chain.proceed(originalRequest); + } + + Request compressedRequest = originalRequest.newBuilder() + .header("Content-Encoding", "gzip") + .method(originalRequest.method(), forceContentLength(gzip(originalRequest.body()))) + .build(); + return chain.proceed(compressedRequest); + } + + private RequestBody forceContentLength(final RequestBody requestBody) throws IOException { + final Buffer buffer = new Buffer(); + requestBody.writeTo(buffer); + return new RequestBody() { + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() { + return buffer.size(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + sink.write(buffer.snapshot()); + } + }; + } + + private RequestBody gzip(final RequestBody body) { + return new RequestBody() { + @Override + public MediaType contentType() { + return body.contentType(); + } + + @Override + public long contentLength() { + return -1; // We don't know the compressed length in advance! + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink gzipSink = Okio.buffer(new GzipSink(sink)); + body.writeTo(gzipSink); + gzipSink.close(); + } + }; + } +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/JSON.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/JSON.java new file mode 100644 index 0000000000..3885a27c5b --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/JSON.java @@ -0,0 +1,527 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.JsonPrimitive; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.TypeAdapter; +import com.google.gson.internal.bind.util.ISO8601Utils; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonElement; +import io.gsonfire.GsonFireBuilder; +import io.gsonfire.TypeSelector; + +import okio.ByteString; + +import java.io.IOException; +import java.io.StringReader; +import java.lang.reflect.Type; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.ParsePosition; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Date; +import java.util.Locale; +import java.util.Map; +import java.util.HashMap; + +/* + * A JSON utility class + * + * NOTE: in the future, this class may be converted to static, which may break + * backward-compatibility + */ +public class JSON { + private static Gson gson; + private static boolean isLenientOnJson = false; + private static DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); + private static SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); + private static OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); + private static LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); + private static ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); + + @SuppressWarnings("unchecked") + public static GsonBuilder createGson() { + GsonFireBuilder fireBuilder = new GsonFireBuilder() + ; + GsonBuilder builder = fireBuilder.createGsonBuilder(); + return builder; + } + + private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { + JsonElement element = readElement.getAsJsonObject().get(discriminatorField); + if (null == element) { + throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">"); + } + return element.getAsString(); + } + + /** + * Returns the Java class that implements the OpenAPI schema for the specified discriminator value. + * + * @param classByDiscriminatorValue The map of discriminator values to Java classes. + * @param discriminatorValue The value of the OpenAPI discriminator in the input data. + * @return The Java class that implements the OpenAPI schema + */ + private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) { + Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue); + if (null == clazz) { + throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">"); + } + return clazz; + } + + { + GsonBuilder gsonBuilder = createGson(); + gsonBuilder.registerTypeAdapter(Date.class, dateTypeAdapter); + gsonBuilder.registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter); + gsonBuilder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter); + gsonBuilder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); + gsonBuilder.registerTypeAdapter(byte[].class, byteArrayAdapter); + + /** + * For the "type: number" schema we accept both Double and Integer + * In the case that we pass "1.0" or "1" we serialize the JsonPrimitive + * as the "1" literal. This is useful when the server expects an integer. + */ + gsonBuilder.registerTypeAdapter(Double.class, new JsonSerializer() { + + @Override + public JsonElement serialize(Double src, Type typeOfSrc, JsonSerializationContext context) { + if (src == src.longValue()) + return new JsonPrimitive(src.longValue()); + return new JsonPrimitive(src); + } + }); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.Account.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.AccountBalance.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.AccountBalanceNullable.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.AccountHoldings.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.AccountHoldingsAccount.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.AccountOrderRecord.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.AccountSimple.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.AccountSyncStatus.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.Amount.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.AmountNullable.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.Balance.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.Brokerage.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.BrokerageAuthorization.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.BrokerageAuthorizationDisabledConfirmation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.BrokerageAuthorizationRefreshConfirmation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.BrokerageAuthorizationType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.BrokerageAuthorizationTypeReadOnly.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.BrokerageAuthorizationTypeReadOnlyBrokerage.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.BrokerageSymbol.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.BrokerageType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.CalculatedTrade.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.CashRestriction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.Currency.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.CurrencyNullable.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.DeleteUserResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.DividendAtDate.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.EncryptedResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.EncryptedResponseEncryptedMessageData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.Exchange.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.ExchangeRatePairs.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.ExcludedAsset.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.FigiInstrument.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.FigiInstrumentNullable.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.HoldingsStatus.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.JWT.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.LoginRedirectURI.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.ManualTrade.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.ManualTradeAndImpact.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.ManualTradeBalance.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.ManualTradeForm.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.ManualTradeSymbol.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.ModelAssetClass.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.ModelAssetClassDetails.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.ModelAssetClassTarget.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.ModelPortfolio.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.ModelPortfolioAssetClass.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.ModelPortfolioDetails.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.ModelPortfolioSecurity.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.MonthlyDividends.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.NetContributions.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.NetDividend.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.OptionBrokerageSymbol.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.OptionChainInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.OptionChainInnerChainPerRootInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.OptionChainInnerChainPerRootInnerChainPerStrikePriceInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.OptionLeg.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.OptionStrategy.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.OptionStrategyLegsInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.OptionsGetOptionStrategyRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.OptionsPlaceOptionStrategyRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.OptionsPosition.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.OptionsSymbol.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.OptionsSymbolNullable.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.PartnerData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.PastValue.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.PerformanceCustom.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.PortfolioGroup.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.PortfolioGroupInfo.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.PortfolioGroupPosition.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.PortfolioGroupSettings.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.Position.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.PositionSymbol.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.RedirectTokenandPin.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.SecurityType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.SessionEvent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.SnapTradeAPIDisclaimerAcceptStatus.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.SnapTradeHoldingsAccount.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.SnapTradeHoldingsAccountAccountId.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.SnapTradeHoldingsTotalValue.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.SnapTradeLoginUserRequestBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.SnapTradeRegisterUserRequestBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.Status.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.StrategyImpact.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.StrategyImpactLegsInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.StrategyOrderPlace.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.StrategyOrderPlaceOrdersInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.StrategyOrderPlaceOrdersInnerLegsInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.StrategyOrderRecord.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.StrategyQuotes.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.StrategyQuotesGreek.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.SubPeriodReturnRate.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.Symbol.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.SymbolQuery.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.SymbolsQuotesInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.TargetAsset.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.Trade.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.TradeExecutionStatus.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.TradeImpact.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.TradingCancelUserAccountOrderRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.TransactionsStatus.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.USExchange.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.UnderlyingSymbol.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.UniversalActivity.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.UniversalSymbol.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.UniversalSymbolNullable.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.UserErrorLog.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.UserIDandSecret.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.UserSettings.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.konfigthis.client.model.ValidatedTradeBody.CustomTypeAdapterFactory()); + gsonBuilder.disableHtmlEscaping(); + gson = gsonBuilder.create(); + } + + /** + * Get Gson. + * + * @return Gson + */ + public static Gson getGson() { + return gson; + } + + /** + * Set Gson. + * + * @param gson Gson + */ + public static void setGson(Gson gson) { + JSON.gson = gson; + } + + public static void setLenientOnJson(boolean lenientOnJson) { + isLenientOnJson = lenientOnJson; + } + + /** + * Serialize the given Java object into JSON string. + * + * @param obj Object + * @return String representation of the JSON + */ + public static String serialize(Object obj) { + return gson.toJson(obj); + } + + /** + * Deserialize the given JSON string to Java object. + * + * @param Type + * @param body The JSON string + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public static T deserialize(String body, Type returnType) { + try { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(new StringReader(body)); + // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(body, returnType); + } + } catch (JsonParseException e) { + // Fallback processing when failed to parse JSON form response body: + // return the response body string directly for the String return type; + if (returnType.equals(String.class)) { + return (T) body; + } else { + throw (e); + } + } + } + + /** + * Gson TypeAdapter for Byte Array type + */ + public static class ByteArrayAdapter extends TypeAdapter { + + @Override + public void write(JsonWriter out, byte[] value) throws IOException { + if (value == null) { + out.nullValue(); + } else { + out.value(ByteString.of(value).base64()); + } + } + + @Override + public byte[] read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String bytesAsBase64 = in.nextString(); + ByteString byteString = ByteString.decodeBase64(bytesAsBase64); + return byteString.toByteArray(); + } + } + } + + /** + * Gson TypeAdapter for JSR310 OffsetDateTime type + */ + public static class OffsetDateTimeTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public OffsetDateTimeTypeAdapter() { + this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } + + public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, OffsetDateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public OffsetDateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + if (date.endsWith("+0000")) { + date = date.substring(0, date.length()-5) + "Z"; + } + return OffsetDateTime.parse(date, formatter); + } + } + } + + /** + * Gson TypeAdapter for JSR310 LocalDate type + */ + public static class LocalDateTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public LocalDateTypeAdapter() { + this(DateTimeFormatter.ISO_LOCAL_DATE); + } + + public LocalDateTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return LocalDate.parse(date, formatter); + } + } + } + + public static void setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + offsetDateTimeTypeAdapter.setFormat(dateFormat); + } + + public static void setLocalDateFormat(DateTimeFormatter dateFormat) { + localDateTypeAdapter.setFormat(dateFormat); + } + + /** + * Gson TypeAdapter for java.sql.Date type + * If the dateFormat is null, a simple "yyyy-MM-dd" format will be used + * (more efficient than SimpleDateFormat). + */ + public static class SqlDateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public SqlDateTypeAdapter() {} + + public SqlDateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, java.sql.Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = date.toString(); + } + out.value(value); + } + } + + @Override + public java.sql.Date read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return new java.sql.Date(dateFormat.parse(date).getTime()); + } + return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } + } + + /** + * Gson TypeAdapter for java.util.Date type + * If the dateFormat is null, ISO8601Utils will be used. + */ + public static class DateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public DateTypeAdapter() {} + + public DateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = ISO8601Utils.format(date, true); + } + out.value(value); + } + } + + @Override + public Date read(JsonReader in) throws IOException { + try { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return dateFormat.parse(date); + } + return ISO8601Utils.parse(date, new ParsePosition(0)); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } catch (IllegalArgumentException e) { + throw new JsonParseException(e); + } + } + } + + public static void setDateFormat(DateFormat dateFormat) { + dateTypeAdapter.setFormat(dateFormat); + } + + public static void setSqlDateFormat(DateFormat dateFormat) { + sqlDateTypeAdapter.setFormat(dateFormat); + } +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/Pair.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/Pair.java new file mode 100644 index 0000000000..156a905815 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/Pair.java @@ -0,0 +1,56 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client; + +@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class Pair { + private String name = ""; + private String value = ""; + + public Pair (String name, String value) { + setName(name); + setValue(value); + } + + private void setName(String name) { + if (!isValidString(name)) { + return; + } + + this.name = name; + } + + private void setValue(String value) { + if (!isValidString(value)) { + return; + } + + this.value = value; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private boolean isValidString(String arg) { + if (arg == null) { + return false; + } + + return true; + } +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/ProgressRequestBody.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/ProgressRequestBody.java new file mode 100644 index 0000000000..6af03e10ce --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/ProgressRequestBody.java @@ -0,0 +1,72 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client; + +import okhttp3.MediaType; +import okhttp3.RequestBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSink; +import okio.ForwardingSink; +import okio.Okio; +import okio.Sink; + +public class ProgressRequestBody extends RequestBody { + + private final RequestBody requestBody; + + private final ApiCallback callback; + + public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { + this.requestBody = requestBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() throws IOException { + return requestBody.contentLength(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink bufferedSink = Okio.buffer(sink(sink)); + requestBody.writeTo(bufferedSink); + bufferedSink.flush(); + } + + private Sink sink(Sink sink) { + return new ForwardingSink(sink) { + + long bytesWritten = 0L; + long contentLength = 0L; + + @Override + public void write(Buffer source, long byteCount) throws IOException { + super.write(source, byteCount); + if (contentLength == 0) { + contentLength = contentLength(); + } + + bytesWritten += byteCount; + callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength); + } + }; + } +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/ProgressResponseBody.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/ProgressResponseBody.java new file mode 100644 index 0000000000..94834d4886 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/ProgressResponseBody.java @@ -0,0 +1,69 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client; + +import okhttp3.MediaType; +import okhttp3.ResponseBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSource; +import okio.ForwardingSource; +import okio.Okio; +import okio.Source; + +public class ProgressResponseBody extends ResponseBody { + + private final ResponseBody responseBody; + private final ApiCallback callback; + private BufferedSource bufferedSource; + + public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { + this.responseBody = responseBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return responseBody.contentType(); + } + + @Override + public long contentLength() { + return responseBody.contentLength(); + } + + @Override + public BufferedSource source() { + if (bufferedSource == null) { + bufferedSource = Okio.buffer(source(responseBody.source())); + } + return bufferedSource; + } + + private Source source(Source source) { + return new ForwardingSource(source) { + long totalBytesRead = 0L; + + @Override + public long read(Buffer sink, long byteCount) throws IOException { + long bytesRead = super.read(sink, byteCount); + // read() returns the number of bytes read, or -1 if this source is exhausted. + totalBytesRead += bytesRead != -1 ? bytesRead : 0; + callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1); + return bytesRead; + } + }; + } +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/ServerConfiguration.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/ServerConfiguration.java new file mode 100644 index 0000000000..9fc493404b --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/ServerConfiguration.java @@ -0,0 +1,58 @@ +package com.konfigthis.client; + +import java.util.Map; + +/** + * Representing a Server configuration. + */ +public class ServerConfiguration { + public String URL; + public String description; + public Map variables; + + /** + * @param URL A URL to the target host. + * @param description A description of the host designated by the URL. + * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. + */ + public ServerConfiguration(String URL, String description, Map variables) { + this.URL = URL; + this.description = description; + this.variables = variables; + } + + /** + * Format URL template using given variables. + * + * @param variables A map between a variable name and its value. + * @return Formatted URL. + */ + public String URL(Map variables) { + String url = this.URL; + + // go through variables and replace placeholders + for (Map.Entry variable: this.variables.entrySet()) { + String name = variable.getKey(); + ServerVariable serverVariable = variable.getValue(); + String value = serverVariable.defaultValue; + + if (variables != null && variables.containsKey(name)) { + value = variables.get(name); + if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) { + throw new IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replace("{" + name + "}", value); + } + return url; + } + + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/ServerVariable.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/ServerVariable.java new file mode 100644 index 0000000000..5e4f921f00 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/ServerVariable.java @@ -0,0 +1,23 @@ +package com.konfigthis.client; + +import java.util.HashSet; + +/** + * Representing a Server Variable for server URL template substitution. + */ +public class ServerVariable { + public String description; + public String defaultValue; + public HashSet enumValues = null; + + /** + * @param description A description for the server variable. + * @param defaultValue The default value to use for substitution. + * @param enumValues An enumeration of string values to be used if the substitution options are from a limited set. + */ + public ServerVariable(String description, String defaultValue, HashSet enumValues) { + this.description = description; + this.defaultValue = defaultValue; + this.enumValues = enumValues; + } +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/Snaptrade.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/Snaptrade.java new file mode 100644 index 0000000000..f17b5c2457 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/Snaptrade.java @@ -0,0 +1,39 @@ +package com.konfigthis.client; + +import com.konfigthis.client.api.AccountInformationApi; +import com.konfigthis.client.api.ApiStatusApi; +import com.konfigthis.client.api.AuthenticationApi; +import com.konfigthis.client.api.ConnectionsApi; +import com.konfigthis.client.api.OptionsApi; +import com.konfigthis.client.api.ReferenceDataApi; +import com.konfigthis.client.api.TradingApi; +import com.konfigthis.client.api.TransactionsAndReportingApi; + +public class Snaptrade { + private ApiClient apiClient; + public final AccountInformationApi accountInformation; + public final ApiStatusApi apiStatus; + public final AuthenticationApi authentication; + public final ConnectionsApi connections; + public final OptionsApi options; + public final ReferenceDataApi referenceData; + public final TradingApi trading; + public final TransactionsAndReportingApi transactionsAndReporting; + + public Snaptrade() { + this(null); + } + + public Snaptrade(Configuration configuration) { + this.apiClient = new ApiClient(null, configuration); + this.accountInformation = new AccountInformationApi(this.apiClient); + this.apiStatus = new ApiStatusApi(this.apiClient); + this.authentication = new AuthenticationApi(this.apiClient); + this.connections = new ConnectionsApi(this.apiClient); + this.options = new OptionsApi(this.apiClient); + this.referenceData = new ReferenceDataApi(this.apiClient); + this.trading = new TradingApi(this.apiClient); + this.transactionsAndReporting = new TransactionsAndReportingApi(this.apiClient); + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/StringUtil.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/StringUtil.java new file mode 100644 index 0000000000..be67bd588c --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/StringUtil.java @@ -0,0 +1,82 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client; + +import java.util.Collection; +import java.util.Iterator; + +@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class StringUtil { + /** + * Check if the given array contains the given value (with case-insensitive comparison). + * + * @param array The array + * @param value The value to search + * @return true if the array contains the value + */ + public static boolean containsIgnoreCase(String[] array, String value) { + for (String str : array) { + if (value == null && str == null) { + return true; + } + if (value != null && value.equalsIgnoreCase(str)) { + return true; + } + } + return false; + } + + /** + * Join an array of strings with the given separator. + *

+ * Note: This might be replaced by utility method from commons-lang or guava someday + * if one of those libraries is added as dependency. + *

+ * + * @param array The array of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(String[] array, String separator) { + int len = array.length; + if (len == 0) { + return ""; + } + + StringBuilder out = new StringBuilder(); + out.append(array[0]); + for (int i = 1; i < len; i++) { + out.append(separator).append(array[i]); + } + return out.toString(); + } + + /** + * Join a list of strings with the given separator. + * + * @param list The list of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(Collection list, String separator) { + Iterator iterator = list.iterator(); + StringBuilder out = new StringBuilder(); + if (iterator.hasNext()) { + out.append(iterator.next()); + } + while (iterator.hasNext()) { + out.append(separator).append(iterator.next()); + } + return out.toString(); + } +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/AccountInformationApi.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/AccountInformationApi.java new file mode 100644 index 0000000000..91e7f0828a --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/AccountInformationApi.java @@ -0,0 +1,61 @@ +package com.konfigthis.client.api; + +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.model.Account; +import com.konfigthis.client.model.AccountHoldings; +import com.konfigthis.client.model.AccountHoldingsAccount; +import com.konfigthis.client.model.AccountOrderRecord; +import com.konfigthis.client.model.Balance; +import com.konfigthis.client.model.Position; +import java.util.UUID; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class AccountInformationApi extends AccountInformationApiGenerated { + + public AccountInformationApi(ApiClient apiClient) throws IllegalArgumentException { + super(apiClient); + } + public class GetAllUserHoldingsRequestBuilder extends GetAllUserHoldingsRequestBuilderGenerated { + public GetAllUserHoldingsRequestBuilder(String userId, String userSecret) { + super(userId, userSecret); + } + } + public class GetUserAccountBalanceRequestBuilder extends GetUserAccountBalanceRequestBuilderGenerated { + public GetUserAccountBalanceRequestBuilder(String userId, String userSecret, UUID accountId) { + super(userId, userSecret, accountId); + } + } + public class GetUserAccountDetailsRequestBuilder extends GetUserAccountDetailsRequestBuilderGenerated { + public GetUserAccountDetailsRequestBuilder(String userId, String userSecret, UUID accountId) { + super(userId, userSecret, accountId); + } + } + public class GetUserAccountOrdersRequestBuilder extends GetUserAccountOrdersRequestBuilderGenerated { + public GetUserAccountOrdersRequestBuilder(String userId, String userSecret, UUID accountId) { + super(userId, userSecret, accountId); + } + } + public class GetUserAccountPositionsRequestBuilder extends GetUserAccountPositionsRequestBuilderGenerated { + public GetUserAccountPositionsRequestBuilder(String userId, String userSecret, UUID accountId) { + super(userId, userSecret, accountId); + } + } + public class GetUserHoldingsRequestBuilder extends GetUserHoldingsRequestBuilderGenerated { + public GetUserHoldingsRequestBuilder(UUID accountId, String userId, String userSecret) { + super(accountId, userId, userSecret); + } + } + public class ListUserAccountsRequestBuilder extends ListUserAccountsRequestBuilderGenerated { + public ListUserAccountsRequestBuilder(String userId, String userSecret) { + super(userId, userSecret); + } + } + public class UpdateUserAccountRequestBuilder extends UpdateUserAccountRequestBuilderGenerated { + public UpdateUserAccountRequestBuilder(String userId, String userSecret, UUID accountId) { + super(userId, userSecret, accountId); + } + } +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/AccountInformationApiGenerated.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/AccountInformationApiGenerated.java new file mode 100644 index 0000000000..588600036e --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/AccountInformationApiGenerated.java @@ -0,0 +1,1636 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.api; + +import com.konfigthis.client.ApiCallback; +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.Pair; +import com.konfigthis.client.ProgressRequestBody; +import com.konfigthis.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.konfigthis.client.model.Account; +import com.konfigthis.client.model.AccountHoldings; +import com.konfigthis.client.model.AccountHoldingsAccount; +import com.konfigthis.client.model.AccountOrderRecord; +import com.konfigthis.client.model.Balance; +import com.konfigthis.client.model.Position; +import java.util.UUID; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.ws.rs.core.GenericType; + +public class AccountInformationApiGenerated { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public AccountInformationApiGenerated() throws IllegalArgumentException { + this(Configuration.getDefaultApiClient()); + } + + public AccountInformationApiGenerated(ApiClient apiClient) throws IllegalArgumentException { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + private okhttp3.Call getAllUserHoldingsCall(String userId, String userSecret, UUID brokerageAuthorizations, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/holdings"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (userId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userId", userId)); + } + + if (userSecret != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userSecret", userSecret)); + } + + if (brokerageAuthorizations != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("brokerage_authorizations", brokerageAuthorizations)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call getAllUserHoldingsValidateBeforeCall(String userId, String userSecret, UUID brokerageAuthorizations, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException("Missing the required parameter 'userId' when calling getAllUserHoldings(Async)"); + } + + // verify the required parameter 'userSecret' is set + if (userSecret == null) { + throw new ApiException("Missing the required parameter 'userSecret' when calling getAllUserHoldings(Async)"); + } + + return getAllUserHoldingsCall(userId, userSecret, brokerageAuthorizations, _callback); + + } + + + private ApiResponse> getAllUserHoldingsWithHttpInfo(String userId, String userSecret, UUID brokerageAuthorizations) throws ApiException { + okhttp3.Call localVarCall = getAllUserHoldingsValidateBeforeCall(userId, userSecret, brokerageAuthorizations, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getAllUserHoldingsAsync(String userId, String userSecret, UUID brokerageAuthorizations, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getAllUserHoldingsValidateBeforeCall(userId, userSecret, brokerageAuthorizations, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class GetAllUserHoldingsRequestBuilderGenerated { + final String userId; + final String userSecret; + UUID brokerageAuthorizations; + + public GetAllUserHoldingsRequestBuilderGenerated(String userId, String userSecret) { + this.userId = userId; + this.userSecret = userSecret; + } + + /** + * Set brokerageAuthorizations + * @param brokerageAuthorizations Optional. Comma seperated list of authorization IDs (only use if filtering is needed on one or more authorizations). (optional) + * @return AccountInformationApi.GetAllUserHoldingsRequestBuilder + */ + public AccountInformationApi.GetAllUserHoldingsRequestBuilder brokerageAuthorizations(UUID brokerageAuthorizations) { + this.brokerageAuthorizations = brokerageAuthorizations; + return (AccountInformationApi.GetAllUserHoldingsRequestBuilder) this; + } + + /** + * Build call for getAllUserHoldings + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Returns list of accounts and holdings -
500 Unexpected Error -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getAllUserHoldingsCall(userId, userSecret, brokerageAuthorizations, _callback); + } + + + /** + * Execute getAllUserHoldings request + * @return List<AccountHoldings> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Returns list of accounts and holdings -
500 Unexpected Error -
+ * @deprecated + */ + @Deprecated + public List execute() throws ApiException { + ApiResponse> localVarResp = getAllUserHoldingsWithHttpInfo(userId, userSecret, brokerageAuthorizations); + return localVarResp.getResponseBody(); + } + + /** + * Execute getAllUserHoldings request with HTTP info returned + * @return ApiResponse<List<AccountHoldings>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Returns list of accounts and holdings -
500 Unexpected Error -
+ * @deprecated + */ + @Deprecated + public ApiResponse> executeWithHttpInfo() throws ApiException { + return getAllUserHoldingsWithHttpInfo(userId, userSecret, brokerageAuthorizations); + } + + /** + * Execute getAllUserHoldings request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Returns list of accounts and holdings -
500 Unexpected Error -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return getAllUserHoldingsAsync(userId, userSecret, brokerageAuthorizations, _callback); + } + } + + /** + * List all accounts for the user, plus balances, positions, and orders for each account. + * **Deprecated, please use the account-specific holdings endpoint instead.** List all accounts for the user, plus balances, positions, and orders for each account. + * @param userId (required) + * @param userSecret (required) + * @return GetAllUserHoldingsRequestBuilder + * @http.response.details + + + + +
Status Code Description Response Headers
200 Returns list of accounts and holdings -
500 Unexpected Error -
+ * @deprecated + */ + @Deprecated + public AccountInformationApi.GetAllUserHoldingsRequestBuilder getAllUserHoldings(String userId, String userSecret) throws IllegalArgumentException { + if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null"); + + + if (userSecret == null) throw new IllegalArgumentException("\"userSecret\" is required but got null"); + + + return ((AccountInformationApi) this).new GetAllUserHoldingsRequestBuilder(userId, userSecret); + } + private okhttp3.Call getUserAccountBalanceCall(String userId, String userSecret, UUID accountId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/balances" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (userId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userId", userId)); + } + + if (userSecret != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userSecret", userSecret)); + } + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUserAccountBalanceValidateBeforeCall(String userId, String userSecret, UUID accountId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException("Missing the required parameter 'userId' when calling getUserAccountBalance(Async)"); + } + + // verify the required parameter 'userSecret' is set + if (userSecret == null) { + throw new ApiException("Missing the required parameter 'userSecret' when calling getUserAccountBalance(Async)"); + } + + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling getUserAccountBalance(Async)"); + } + + return getUserAccountBalanceCall(userId, userSecret, accountId, _callback); + + } + + + private ApiResponse> getUserAccountBalanceWithHttpInfo(String userId, String userSecret, UUID accountId) throws ApiException { + okhttp3.Call localVarCall = getUserAccountBalanceValidateBeforeCall(userId, userSecret, accountId, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getUserAccountBalanceAsync(String userId, String userSecret, UUID accountId, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getUserAccountBalanceValidateBeforeCall(userId, userSecret, accountId, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class GetUserAccountBalanceRequestBuilderGenerated { + final String userId; + final String userSecret; + final UUID accountId; + + public GetUserAccountBalanceRequestBuilderGenerated(String userId, String userSecret, UUID accountId) { + this.userId = userId; + this.userSecret = userSecret; + this.accountId = accountId; + } + + /** + * Build call for getUserAccountBalance + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 List of all balances in investment account -
0 Unexpected error -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getUserAccountBalanceCall(userId, userSecret, accountId, _callback); + } + + + /** + * Execute getUserAccountBalance request + * @return List<Balance> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 List of all balances in investment account -
0 Unexpected error -
+ */ + public List execute() throws ApiException { + ApiResponse> localVarResp = getUserAccountBalanceWithHttpInfo(userId, userSecret, accountId); + return localVarResp.getResponseBody(); + } + + /** + * Execute getUserAccountBalance request with HTTP info returned + * @return ApiResponse<List<Balance>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 List of all balances in investment account -
0 Unexpected error -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + return getUserAccountBalanceWithHttpInfo(userId, userSecret, accountId); + } + + /** + * Execute getUserAccountBalance request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 List of all balances in investment account -
0 Unexpected error -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return getUserAccountBalanceAsync(userId, userSecret, accountId, _callback); + } + } + + /** + * List account balances + * A list of account balances for the specified account (one per currency that the account holds). + * @param userId (required) + * @param userSecret (required) + * @param accountId The ID of the account to get balances. (required) + * @return GetUserAccountBalanceRequestBuilder + * @http.response.details + + + + +
Status Code Description Response Headers
200 List of all balances in investment account -
0 Unexpected error -
+ */ + public AccountInformationApi.GetUserAccountBalanceRequestBuilder getUserAccountBalance(String userId, String userSecret, UUID accountId) throws IllegalArgumentException { + if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null"); + + + if (userSecret == null) throw new IllegalArgumentException("\"userSecret\" is required but got null"); + + + if (accountId == null) throw new IllegalArgumentException("\"accountId\" is required but got null"); + + + return ((AccountInformationApi) this).new GetUserAccountBalanceRequestBuilder(userId, userSecret, accountId); + } + private okhttp3.Call getUserAccountDetailsCall(String userId, String userSecret, UUID accountId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (userId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userId", userId)); + } + + if (userSecret != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userSecret", userSecret)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUserAccountDetailsValidateBeforeCall(String userId, String userSecret, UUID accountId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException("Missing the required parameter 'userId' when calling getUserAccountDetails(Async)"); + } + + // verify the required parameter 'userSecret' is set + if (userSecret == null) { + throw new ApiException("Missing the required parameter 'userSecret' when calling getUserAccountDetails(Async)"); + } + + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling getUserAccountDetails(Async)"); + } + + return getUserAccountDetailsCall(userId, userSecret, accountId, _callback); + + } + + + private ApiResponse getUserAccountDetailsWithHttpInfo(String userId, String userSecret, UUID accountId) throws ApiException { + okhttp3.Call localVarCall = getUserAccountDetailsValidateBeforeCall(userId, userSecret, accountId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getUserAccountDetailsAsync(String userId, String userSecret, UUID accountId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getUserAccountDetailsValidateBeforeCall(userId, userSecret, accountId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class GetUserAccountDetailsRequestBuilderGenerated { + final String userId; + final String userSecret; + final UUID accountId; + + public GetUserAccountDetailsRequestBuilderGenerated(String userId, String userSecret, UUID accountId) { + this.userId = userId; + this.userSecret = userSecret; + this.accountId = accountId; + } + + /** + * Build call for getUserAccountDetails + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Details of a specific investment account -
0 Unexpected error -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getUserAccountDetailsCall(userId, userSecret, accountId, _callback); + } + + + /** + * Execute getUserAccountDetails request + * @return Account + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Details of a specific investment account -
0 Unexpected error -
+ */ + public Account execute() throws ApiException { + ApiResponse localVarResp = getUserAccountDetailsWithHttpInfo(userId, userSecret, accountId); + return localVarResp.getResponseBody(); + } + + /** + * Execute getUserAccountDetails request with HTTP info returned + * @return ApiResponse<Account> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Details of a specific investment account -
0 Unexpected error -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getUserAccountDetailsWithHttpInfo(userId, userSecret, accountId); + } + + /** + * Execute getUserAccountDetails request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Details of a specific investment account -
0 Unexpected error -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getUserAccountDetailsAsync(userId, userSecret, accountId, _callback); + } + } + + /** + * Return details of a specific investment account + * Returns an account object with details for the specified account, including the total account market value. + * @param userId (required) + * @param userSecret (required) + * @param accountId The ID of the account to get detail of. (required) + * @return GetUserAccountDetailsRequestBuilder + * @http.response.details + + + + +
Status Code Description Response Headers
200 Details of a specific investment account -
0 Unexpected error -
+ */ + public AccountInformationApi.GetUserAccountDetailsRequestBuilder getUserAccountDetails(String userId, String userSecret, UUID accountId) throws IllegalArgumentException { + if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null"); + + + if (userSecret == null) throw new IllegalArgumentException("\"userSecret\" is required but got null"); + + + if (accountId == null) throw new IllegalArgumentException("\"accountId\" is required but got null"); + + + return ((AccountInformationApi) this).new GetUserAccountDetailsRequestBuilder(userId, userSecret, accountId); + } + private okhttp3.Call getUserAccountOrdersCall(String userId, String userSecret, UUID accountId, String state, Integer days, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/orders" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (userId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userId", userId)); + } + + if (userSecret != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userSecret", userSecret)); + } + + if (state != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("state", state)); + } + + if (days != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("days", days)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUserAccountOrdersValidateBeforeCall(String userId, String userSecret, UUID accountId, String state, Integer days, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException("Missing the required parameter 'userId' when calling getUserAccountOrders(Async)"); + } + + // verify the required parameter 'userSecret' is set + if (userSecret == null) { + throw new ApiException("Missing the required parameter 'userSecret' when calling getUserAccountOrders(Async)"); + } + + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling getUserAccountOrders(Async)"); + } + + return getUserAccountOrdersCall(userId, userSecret, accountId, state, days, _callback); + + } + + + private ApiResponse> getUserAccountOrdersWithHttpInfo(String userId, String userSecret, UUID accountId, String state, Integer days) throws ApiException { + okhttp3.Call localVarCall = getUserAccountOrdersValidateBeforeCall(userId, userSecret, accountId, state, days, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getUserAccountOrdersAsync(String userId, String userSecret, UUID accountId, String state, Integer days, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getUserAccountOrdersValidateBeforeCall(userId, userSecret, accountId, state, days, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class GetUserAccountOrdersRequestBuilderGenerated { + final String userId; + final String userSecret; + final UUID accountId; + String state; + Integer days; + + public GetUserAccountOrdersRequestBuilderGenerated(String userId, String userSecret, UUID accountId) { + this.userId = userId; + this.userSecret = userSecret; + this.accountId = accountId; + } + + /** + * Set state + * @param state defaults value is set to \"all\" (optional) + * @return AccountInformationApi.GetUserAccountOrdersRequestBuilder + */ + public AccountInformationApi.GetUserAccountOrdersRequestBuilder state(String state) { + this.state = state; + return (AccountInformationApi.GetUserAccountOrdersRequestBuilder) this; + } + + /** + * Set days + * @param days Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. (optional) + * @return AccountInformationApi.GetUserAccountOrdersRequestBuilder + */ + public AccountInformationApi.GetUserAccountOrdersRequestBuilder days(Integer days) { + this.days = days; + return (AccountInformationApi.GetUserAccountOrdersRequestBuilder) this; + } + + /** + * Build call for getUserAccountOrders + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 List all orders in account -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getUserAccountOrdersCall(userId, userSecret, accountId, state, days, _callback); + } + + + /** + * Execute getUserAccountOrders request + * @return List<AccountOrderRecord> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 List all orders in account -
+ */ + public List execute() throws ApiException { + ApiResponse> localVarResp = getUserAccountOrdersWithHttpInfo(userId, userSecret, accountId, state, days); + return localVarResp.getResponseBody(); + } + + /** + * Execute getUserAccountOrders request with HTTP info returned + * @return ApiResponse<List<AccountOrderRecord>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 List all orders in account -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + return getUserAccountOrdersWithHttpInfo(userId, userSecret, accountId, state, days); + } + + /** + * Execute getUserAccountOrders request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 List all orders in account -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return getUserAccountOrdersAsync(userId, userSecret, accountId, state, days, _callback); + } + } + + /** + * List account orders + * Fetch all recent orders from a user's account. + * @param userId (required) + * @param userSecret (required) + * @param accountId The ID of the account to get orders. (required) + * @return GetUserAccountOrdersRequestBuilder + * @http.response.details + + + +
Status Code Description Response Headers
200 List all orders in account -
+ */ + public AccountInformationApi.GetUserAccountOrdersRequestBuilder getUserAccountOrders(String userId, String userSecret, UUID accountId) throws IllegalArgumentException { + if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null"); + + + if (userSecret == null) throw new IllegalArgumentException("\"userSecret\" is required but got null"); + + + if (accountId == null) throw new IllegalArgumentException("\"accountId\" is required but got null"); + + + return ((AccountInformationApi) this).new GetUserAccountOrdersRequestBuilder(userId, userSecret, accountId); + } + private okhttp3.Call getUserAccountPositionsCall(String userId, String userSecret, UUID accountId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/positions" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (userId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userId", userId)); + } + + if (userSecret != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userSecret", userSecret)); + } + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUserAccountPositionsValidateBeforeCall(String userId, String userSecret, UUID accountId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException("Missing the required parameter 'userId' when calling getUserAccountPositions(Async)"); + } + + // verify the required parameter 'userSecret' is set + if (userSecret == null) { + throw new ApiException("Missing the required parameter 'userSecret' when calling getUserAccountPositions(Async)"); + } + + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling getUserAccountPositions(Async)"); + } + + return getUserAccountPositionsCall(userId, userSecret, accountId, _callback); + + } + + + private ApiResponse> getUserAccountPositionsWithHttpInfo(String userId, String userSecret, UUID accountId) throws ApiException { + okhttp3.Call localVarCall = getUserAccountPositionsValidateBeforeCall(userId, userSecret, accountId, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getUserAccountPositionsAsync(String userId, String userSecret, UUID accountId, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getUserAccountPositionsValidateBeforeCall(userId, userSecret, accountId, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class GetUserAccountPositionsRequestBuilderGenerated { + final String userId; + final String userSecret; + final UUID accountId; + + public GetUserAccountPositionsRequestBuilderGenerated(String userId, String userSecret, UUID accountId) { + this.userId = userId; + this.userSecret = userSecret; + this.accountId = accountId; + } + + /** + * Build call for getUserAccountPositions + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 List all positions in investment account -
0 Unexpected error -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getUserAccountPositionsCall(userId, userSecret, accountId, _callback); + } + + + /** + * Execute getUserAccountPositions request + * @return List<Position> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 List all positions in investment account -
0 Unexpected error -
+ */ + public List execute() throws ApiException { + ApiResponse> localVarResp = getUserAccountPositionsWithHttpInfo(userId, userSecret, accountId); + return localVarResp.getResponseBody(); + } + + /** + * Execute getUserAccountPositions request with HTTP info returned + * @return ApiResponse<List<Position>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 List all positions in investment account -
0 Unexpected error -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + return getUserAccountPositionsWithHttpInfo(userId, userSecret, accountId); + } + + /** + * Execute getUserAccountPositions request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 List all positions in investment account -
0 Unexpected error -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return getUserAccountPositionsAsync(userId, userSecret, accountId, _callback); + } + } + + /** + * List account positions + * Returns a list of positions in the specified account. + * @param userId (required) + * @param userSecret (required) + * @param accountId The ID of the account to get positions. (required) + * @return GetUserAccountPositionsRequestBuilder + * @http.response.details + + + + +
Status Code Description Response Headers
200 List all positions in investment account -
0 Unexpected error -
+ */ + public AccountInformationApi.GetUserAccountPositionsRequestBuilder getUserAccountPositions(String userId, String userSecret, UUID accountId) throws IllegalArgumentException { + if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null"); + + + if (userSecret == null) throw new IllegalArgumentException("\"userSecret\" is required but got null"); + + + if (accountId == null) throw new IllegalArgumentException("\"accountId\" is required but got null"); + + + return ((AccountInformationApi) this).new GetUserAccountPositionsRequestBuilder(userId, userSecret, accountId); + } + private okhttp3.Call getUserHoldingsCall(UUID accountId, String userId, String userSecret, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/holdings" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (userId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userId", userId)); + } + + if (userSecret != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userSecret", userSecret)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUserHoldingsValidateBeforeCall(UUID accountId, String userId, String userSecret, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling getUserHoldings(Async)"); + } + + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException("Missing the required parameter 'userId' when calling getUserHoldings(Async)"); + } + + // verify the required parameter 'userSecret' is set + if (userSecret == null) { + throw new ApiException("Missing the required parameter 'userSecret' when calling getUserHoldings(Async)"); + } + + return getUserHoldingsCall(accountId, userId, userSecret, _callback); + + } + + + private ApiResponse getUserHoldingsWithHttpInfo(UUID accountId, String userId, String userSecret) throws ApiException { + okhttp3.Call localVarCall = getUserHoldingsValidateBeforeCall(accountId, userId, userSecret, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getUserHoldingsAsync(UUID accountId, String userId, String userSecret, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getUserHoldingsValidateBeforeCall(accountId, userId, userSecret, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class GetUserHoldingsRequestBuilderGenerated { + final UUID accountId; + final String userId; + final String userSecret; + + public GetUserHoldingsRequestBuilderGenerated(UUID accountId, String userId, String userSecret) { + this.accountId = accountId; + this.userId = userId; + this.userSecret = userSecret; + } + + /** + * Build call for getUserHoldings + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 OK -
500 Unexpected Error -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getUserHoldingsCall(accountId, userId, userSecret, _callback); + } + + + /** + * Execute getUserHoldings request + * @return AccountHoldingsAccount + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 OK -
500 Unexpected Error -
+ */ + public AccountHoldingsAccount execute() throws ApiException { + ApiResponse localVarResp = getUserHoldingsWithHttpInfo(accountId, userId, userSecret); + return localVarResp.getResponseBody(); + } + + /** + * Execute getUserHoldings request with HTTP info returned + * @return ApiResponse<AccountHoldingsAccount> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 OK -
500 Unexpected Error -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getUserHoldingsWithHttpInfo(accountId, userId, userSecret); + } + + /** + * Execute getUserHoldings request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 OK -
500 Unexpected Error -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getUserHoldingsAsync(accountId, userId, userSecret, _callback); + } + } + + /** + * List account holdings + * Lists balances, positions, option positions, and recent orders for the specified account. The data returned is similar to the data returned over the more fine-grained [balances](/reference/Account%20Information/AccountInformation_getUserAccountBalance), [positions](/reference/Account%20Information/AccountInformation_getUserAccountPositions) and [orders](/reference/Account%20Information/AccountInformation_getUserAccountOrders) endpoints. __The finer-grained APIs are preferred. They are easier to work with, faster, and have better error handling than this coarse-grained API.__ + * @param accountId (required) + * @param userId (required) + * @param userSecret (required) + * @return GetUserHoldingsRequestBuilder + * @http.response.details + + + + +
Status Code Description Response Headers
200 OK -
500 Unexpected Error -
+ */ + public AccountInformationApi.GetUserHoldingsRequestBuilder getUserHoldings(UUID accountId, String userId, String userSecret) throws IllegalArgumentException { + if (accountId == null) throw new IllegalArgumentException("\"accountId\" is required but got null"); + + + if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null"); + + + if (userSecret == null) throw new IllegalArgumentException("\"userSecret\" is required but got null"); + + + return ((AccountInformationApi) this).new GetUserHoldingsRequestBuilder(accountId, userId, userSecret); + } + private okhttp3.Call listUserAccountsCall(String userId, String userSecret, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (userId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userId", userId)); + } + + if (userSecret != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userSecret", userSecret)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listUserAccountsValidateBeforeCall(String userId, String userSecret, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException("Missing the required parameter 'userId' when calling listUserAccounts(Async)"); + } + + // verify the required parameter 'userSecret' is set + if (userSecret == null) { + throw new ApiException("Missing the required parameter 'userSecret' when calling listUserAccounts(Async)"); + } + + return listUserAccountsCall(userId, userSecret, _callback); + + } + + + private ApiResponse> listUserAccountsWithHttpInfo(String userId, String userSecret) throws ApiException { + okhttp3.Call localVarCall = listUserAccountsValidateBeforeCall(userId, userSecret, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call listUserAccountsAsync(String userId, String userSecret, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = listUserAccountsValidateBeforeCall(userId, userSecret, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class ListUserAccountsRequestBuilderGenerated { + final String userId; + final String userSecret; + + public ListUserAccountsRequestBuilderGenerated(String userId, String userSecret) { + this.userId = userId; + this.userSecret = userSecret; + } + + /** + * Build call for listUserAccounts + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of all Account objects for the authenticated user. -
0 Unexpected error. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return listUserAccountsCall(userId, userSecret, _callback); + } + + + /** + * Execute listUserAccounts request + * @return List<Account> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of all Account objects for the authenticated user. -
0 Unexpected error. -
+ */ + public List execute() throws ApiException { + ApiResponse> localVarResp = listUserAccountsWithHttpInfo(userId, userSecret); + return localVarResp.getResponseBody(); + } + + /** + * Execute listUserAccounts request with HTTP info returned + * @return ApiResponse<List<Account>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of all Account objects for the authenticated user. -
0 Unexpected error. -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + return listUserAccountsWithHttpInfo(userId, userSecret); + } + + /** + * Execute listUserAccounts request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of all Account objects for the authenticated user. -
0 Unexpected error. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return listUserAccountsAsync(userId, userSecret, _callback); + } + } + + /** + * List accounts + * Get a list of all Account objects for the authenticated SnapTrade user. + * @param userId (required) + * @param userSecret (required) + * @return ListUserAccountsRequestBuilder + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of all Account objects for the authenticated user. -
0 Unexpected error. -
+ */ + public AccountInformationApi.ListUserAccountsRequestBuilder listUserAccounts(String userId, String userSecret) throws IllegalArgumentException { + if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null"); + + + if (userSecret == null) throw new IllegalArgumentException("\"userSecret\" is required but got null"); + + + return ((AccountInformationApi) this).new ListUserAccountsRequestBuilder(userId, userSecret); + } + private okhttp3.Call updateUserAccountCall(String userId, String userSecret, UUID accountId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (userId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userId", userId)); + } + + if (userSecret != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userSecret", userSecret)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateUserAccountValidateBeforeCall(String userId, String userSecret, UUID accountId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException("Missing the required parameter 'userId' when calling updateUserAccount(Async)"); + } + + // verify the required parameter 'userSecret' is set + if (userSecret == null) { + throw new ApiException("Missing the required parameter 'userSecret' when calling updateUserAccount(Async)"); + } + + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling updateUserAccount(Async)"); + } + + return updateUserAccountCall(userId, userSecret, accountId, _callback); + + } + + + private ApiResponse> updateUserAccountWithHttpInfo(String userId, String userSecret, UUID accountId) throws ApiException { + okhttp3.Call localVarCall = updateUserAccountValidateBeforeCall(userId, userSecret, accountId, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call updateUserAccountAsync(String userId, String userSecret, UUID accountId, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = updateUserAccountValidateBeforeCall(userId, userSecret, accountId, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class UpdateUserAccountRequestBuilderGenerated { + final String userId; + final String userSecret; + final UUID accountId; + + public UpdateUserAccountRequestBuilderGenerated(String userId, String userSecret, UUID accountId) { + this.userId = userId; + this.userSecret = userSecret; + this.accountId = accountId; + } + + /** + * Build call for updateUserAccount + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successfully updated details of an investment account -
0 Unexpected error -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return updateUserAccountCall(userId, userSecret, accountId, _callback); + } + + + /** + * Execute updateUserAccount request + * @return List<Account> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successfully updated details of an investment account -
0 Unexpected error -
+ */ + public List execute() throws ApiException { + ApiResponse> localVarResp = updateUserAccountWithHttpInfo(userId, userSecret, accountId); + return localVarResp.getResponseBody(); + } + + /** + * Execute updateUserAccount request with HTTP info returned + * @return ApiResponse<List<Account>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successfully updated details of an investment account -
0 Unexpected error -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + return updateUserAccountWithHttpInfo(userId, userSecret, accountId); + } + + /** + * Execute updateUserAccount request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successfully updated details of an investment account -
0 Unexpected error -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return updateUserAccountAsync(userId, userSecret, accountId, _callback); + } + } + + /** + * Update details of an investment account + * Updates various properties of a specified account. + * @param userId (required) + * @param userSecret (required) + * @param accountId The ID of the account to update. (required) + * @return UpdateUserAccountRequestBuilder + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successfully updated details of an investment account -
0 Unexpected error -
+ */ + public AccountInformationApi.UpdateUserAccountRequestBuilder updateUserAccount(String userId, String userSecret, UUID accountId) throws IllegalArgumentException { + if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null"); + + + if (userSecret == null) throw new IllegalArgumentException("\"userSecret\" is required but got null"); + + + if (accountId == null) throw new IllegalArgumentException("\"accountId\" is required but got null"); + + + return ((AccountInformationApi) this).new UpdateUserAccountRequestBuilder(userId, userSecret, accountId); + } +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/ApiStatusApi.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/ApiStatusApi.java new file mode 100644 index 0000000000..fb76ba2c9b --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/ApiStatusApi.java @@ -0,0 +1,20 @@ +package com.konfigthis.client.api; + +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.model.Status; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ApiStatusApi extends ApiStatusApiGenerated { + + public ApiStatusApi(ApiClient apiClient) throws IllegalArgumentException { + super(apiClient); + } + public class CheckRequestBuilder extends CheckRequestBuilderGenerated { + public CheckRequestBuilder() { + super(); + } + } +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/ApiStatusApiGenerated.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/ApiStatusApiGenerated.java new file mode 100644 index 0000000000..6f5c05a51c --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/ApiStatusApiGenerated.java @@ -0,0 +1,224 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.api; + +import com.konfigthis.client.ApiCallback; +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.Pair; +import com.konfigthis.client.ProgressRequestBody; +import com.konfigthis.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.konfigthis.client.model.Status; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.ws.rs.core.GenericType; + +public class ApiStatusApiGenerated { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public ApiStatusApiGenerated() throws IllegalArgumentException { + this(Configuration.getDefaultApiClient()); + } + + public ApiStatusApiGenerated(ApiClient apiClient) throws IllegalArgumentException { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + private okhttp3.Call checkCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call checkValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return checkCall(_callback); + + } + + + private ApiResponse checkWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = checkValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call checkAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = checkValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class CheckRequestBuilderGenerated { + + public CheckRequestBuilderGenerated() { + } + + /** + * Build call for check + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 API is operational. -
0 Unexpected error. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return checkCall(_callback); + } + + + /** + * Execute check request + * @return Status + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 API is operational. -
0 Unexpected error. -
+ */ + public Status execute() throws ApiException { + ApiResponse localVarResp = checkWithHttpInfo(); + return localVarResp.getResponseBody(); + } + + /** + * Execute check request with HTTP info returned + * @return ApiResponse<Status> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 API is operational. -
0 Unexpected error. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return checkWithHttpInfo(); + } + + /** + * Execute check request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 API is operational. -
0 Unexpected error. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return checkAsync(_callback); + } + } + + /** + * Get API Status + * Check whether the API is operational and verify timestamps. + * @return CheckRequestBuilder + * @http.response.details + + + + +
Status Code Description Response Headers
200 API is operational. -
0 Unexpected error. -
+ */ + public ApiStatusApi.CheckRequestBuilder check() throws IllegalArgumentException { + return ((ApiStatusApi) this).new CheckRequestBuilder(); + } +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/AuthenticationApi.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/AuthenticationApi.java new file mode 100644 index 0000000000..c348807e6d --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/AuthenticationApi.java @@ -0,0 +1,43 @@ +package com.konfigthis.client.api; + +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.model.DeleteUserResponse; +import com.konfigthis.client.model.SnapTradeLoginUserRequestBody; +import com.konfigthis.client.model.SnapTradeRegisterUserRequestBody; +import com.konfigthis.client.model.UserIDandSecret; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class AuthenticationApi extends AuthenticationApiGenerated { + + public AuthenticationApi(ApiClient apiClient) throws IllegalArgumentException { + super(apiClient); + } + public class DeleteSnapTradeUserRequestBuilder extends DeleteSnapTradeUserRequestBuilderGenerated { + public DeleteSnapTradeUserRequestBuilder(String userId) { + super(userId); + } + } + public class ListSnapTradeUsersRequestBuilder extends ListSnapTradeUsersRequestBuilderGenerated { + public ListSnapTradeUsersRequestBuilder() { + super(); + } + } + public class LoginSnapTradeUserRequestBuilder extends LoginSnapTradeUserRequestBuilderGenerated { + public LoginSnapTradeUserRequestBuilder(String userId, String userSecret) { + super(userId, userSecret); + } + } + public class RegisterSnapTradeUserRequestBuilder extends RegisterSnapTradeUserRequestBuilderGenerated { + public RegisterSnapTradeUserRequestBuilder() { + super(); + } + } + public class ResetSnapTradeUserSecretRequestBuilder extends ResetSnapTradeUserSecretRequestBuilderGenerated { + public ResetSnapTradeUserSecretRequestBuilder() { + super(); + } + } +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/AuthenticationApiGenerated.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/AuthenticationApiGenerated.java new file mode 100644 index 0000000000..61748805f6 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/AuthenticationApiGenerated.java @@ -0,0 +1,1002 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.api; + +import com.konfigthis.client.ApiCallback; +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.Pair; +import com.konfigthis.client.ProgressRequestBody; +import com.konfigthis.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.konfigthis.client.model.DeleteUserResponse; +import com.konfigthis.client.model.SnapTradeLoginUserRequestBody; +import com.konfigthis.client.model.SnapTradeRegisterUserRequestBody; +import com.konfigthis.client.model.UserIDandSecret; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.ws.rs.core.GenericType; + +public class AuthenticationApiGenerated { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public AuthenticationApiGenerated() throws IllegalArgumentException { + this(Configuration.getDefaultApiClient()); + } + + public AuthenticationApiGenerated(ApiClient apiClient) throws IllegalArgumentException { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + private okhttp3.Call deleteSnapTradeUserCall(String userId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/snapTrade/deleteUser"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (userId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userId", userId)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteSnapTradeUserValidateBeforeCall(String userId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException("Missing the required parameter 'userId' when calling deleteSnapTradeUser(Async)"); + } + + return deleteSnapTradeUserCall(userId, _callback); + + } + + + private ApiResponse deleteSnapTradeUserWithHttpInfo(String userId) throws ApiException { + okhttp3.Call localVarCall = deleteSnapTradeUserValidateBeforeCall(userId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call deleteSnapTradeUserAsync(String userId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteSnapTradeUserValidateBeforeCall(userId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class DeleteSnapTradeUserRequestBuilderGenerated { + final String userId; + + public DeleteSnapTradeUserRequestBuilderGenerated(String userId) { + this.userId = userId; + } + + /** + * Build call for deleteSnapTradeUser + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Delete successful -
500 Unexpected Error -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return deleteSnapTradeUserCall(userId, _callback); + } + + + /** + * Execute deleteSnapTradeUser request + * @return DeleteUserResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Delete successful -
500 Unexpected Error -
+ */ + public DeleteUserResponse execute() throws ApiException { + ApiResponse localVarResp = deleteSnapTradeUserWithHttpInfo(userId); + return localVarResp.getResponseBody(); + } + + /** + * Execute deleteSnapTradeUser request with HTTP info returned + * @return ApiResponse<DeleteUserResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Delete successful -
500 Unexpected Error -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return deleteSnapTradeUserWithHttpInfo(userId); + } + + /** + * Execute deleteSnapTradeUser request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Delete successful -
500 Unexpected Error -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return deleteSnapTradeUserAsync(userId, _callback); + } + } + + /** + * Delete SnapTrade user + * Deletes a user you've registered over the SnapTrade API, and any data associated with them or their investment accounts. + * @param userId (required) + * @return DeleteSnapTradeUserRequestBuilder + * @http.response.details + + + + +
Status Code Description Response Headers
200 Delete successful -
500 Unexpected Error -
+ */ + public AuthenticationApi.DeleteSnapTradeUserRequestBuilder deleteSnapTradeUser(String userId) throws IllegalArgumentException { + if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null"); + + + return ((AuthenticationApi) this).new DeleteSnapTradeUserRequestBuilder(userId); + } + private okhttp3.Call listSnapTradeUsersCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/snapTrade/listUsers"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listSnapTradeUsersValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return listSnapTradeUsersCall(_callback); + + } + + + private ApiResponse> listSnapTradeUsersWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = listSnapTradeUsersValidateBeforeCall(null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call listSnapTradeUsersAsync(final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = listSnapTradeUsersValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class ListSnapTradeUsersRequestBuilderGenerated { + + public ListSnapTradeUsersRequestBuilderGenerated() { + } + + /** + * Build call for listSnapTradeUsers + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successfully retrieved a list of users -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return listSnapTradeUsersCall(_callback); + } + + + /** + * Execute listSnapTradeUsers request + * @return List<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successfully retrieved a list of users -
+ */ + public List execute() throws ApiException { + ApiResponse> localVarResp = listSnapTradeUsersWithHttpInfo(); + return localVarResp.getResponseBody(); + } + + /** + * Execute listSnapTradeUsers request with HTTP info returned + * @return ApiResponse<List<String>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successfully retrieved a list of users -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + return listSnapTradeUsersWithHttpInfo(); + } + + /** + * Execute listSnapTradeUsers request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successfully retrieved a list of users -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return listSnapTradeUsersAsync(_callback); + } + } + + /** + * List SnapTrade users + * Returns a list of users you've registered over the SnapTrade API. + * @return ListSnapTradeUsersRequestBuilder + * @http.response.details + + + +
Status Code Description Response Headers
200 Successfully retrieved a list of users -
+ */ + public AuthenticationApi.ListSnapTradeUsersRequestBuilder listSnapTradeUsers() throws IllegalArgumentException { + return ((AuthenticationApi) this).new ListSnapTradeUsersRequestBuilder(); + } + private okhttp3.Call loginSnapTradeUserCall(String userId, String userSecret, SnapTradeLoginUserRequestBody snapTradeLoginUserRequestBody, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = snapTradeLoginUserRequestBody; + + // create path and map variables + String localVarPath = "/snapTrade/login"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (userId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userId", userId)); + } + + if (userSecret != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userSecret", userSecret)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call loginSnapTradeUserValidateBeforeCall(String userId, String userSecret, SnapTradeLoginUserRequestBody snapTradeLoginUserRequestBody, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException("Missing the required parameter 'userId' when calling loginSnapTradeUser(Async)"); + } + + // verify the required parameter 'userSecret' is set + if (userSecret == null) { + throw new ApiException("Missing the required parameter 'userSecret' when calling loginSnapTradeUser(Async)"); + } + + return loginSnapTradeUserCall(userId, userSecret, snapTradeLoginUserRequestBody, _callback); + + } + + + private ApiResponse loginSnapTradeUserWithHttpInfo(String userId, String userSecret, SnapTradeLoginUserRequestBody snapTradeLoginUserRequestBody) throws ApiException { + okhttp3.Call localVarCall = loginSnapTradeUserValidateBeforeCall(userId, userSecret, snapTradeLoginUserRequestBody, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call loginSnapTradeUserAsync(String userId, String userSecret, SnapTradeLoginUserRequestBody snapTradeLoginUserRequestBody, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = loginSnapTradeUserValidateBeforeCall(userId, userSecret, snapTradeLoginUserRequestBody, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class LoginSnapTradeUserRequestBuilderGenerated { + final String userId; + final String userSecret; + String broker; + Boolean immediateRedirect; + String customRedirect; + String reconnect; + String connectionType; + String connectionPortalVersion; + + public LoginSnapTradeUserRequestBuilderGenerated(String userId, String userSecret) { + this.userId = userId; + this.userSecret = userSecret; + } + + /** + * Set broker + * @param broker Slug of the brokerage to connect the user to. See [this document](https://snaptrade.notion.site/SnapTrade-Brokerage-Integrations-f83946a714a84c3caf599f6a945f0ead) for a list of supported brokerages and their slugs. (optional) + * @return AuthenticationApi.LoginSnapTradeUserRequestBuilder + */ + public AuthenticationApi.LoginSnapTradeUserRequestBuilder broker(String broker) { + this.broker = broker; + return (AuthenticationApi.LoginSnapTradeUserRequestBuilder) this; + } + + /** + * Set immediateRedirect + * @param immediateRedirect When set to True, user will be redirected back to the partner's site instead of the connection portal (optional) + * @return AuthenticationApi.LoginSnapTradeUserRequestBuilder + */ + public AuthenticationApi.LoginSnapTradeUserRequestBuilder immediateRedirect(Boolean immediateRedirect) { + this.immediateRedirect = immediateRedirect; + return (AuthenticationApi.LoginSnapTradeUserRequestBuilder) this; + } + + /** + * Set customRedirect + * @param customRedirect URL to redirect the user to after the user connects their brokerage account (optional) + * @return AuthenticationApi.LoginSnapTradeUserRequestBuilder + */ + public AuthenticationApi.LoginSnapTradeUserRequestBuilder customRedirect(String customRedirect) { + this.customRedirect = customRedirect; + return (AuthenticationApi.LoginSnapTradeUserRequestBuilder) this; + } + + /** + * Set reconnect + * @param reconnect The UUID of the brokerage connection to be reconnected. This parameter should be left empty unless you are reconnecting a disabled connection. See ‘Reconnecting Accounts’ for more information. (optional) + * @return AuthenticationApi.LoginSnapTradeUserRequestBuilder + */ + public AuthenticationApi.LoginSnapTradeUserRequestBuilder reconnect(String reconnect) { + this.reconnect = reconnect; + return (AuthenticationApi.LoginSnapTradeUserRequestBuilder) this; + } + + /** + * Set connectionType + * @param connectionType Sets whether the connection should be read or trade (optional) + * @return AuthenticationApi.LoginSnapTradeUserRequestBuilder + */ + public AuthenticationApi.LoginSnapTradeUserRequestBuilder connectionType(String connectionType) { + this.connectionType = connectionType; + return (AuthenticationApi.LoginSnapTradeUserRequestBuilder) this; + } + + /** + * Set connectionPortalVersion + * @param connectionPortalVersion Sets the version of the connection portal to render, with a default to 'v3' (optional) + * @return AuthenticationApi.LoginSnapTradeUserRequestBuilder + */ + public AuthenticationApi.LoginSnapTradeUserRequestBuilder connectionPortalVersion(String connectionPortalVersion) { + this.connectionPortalVersion = connectionPortalVersion; + return (AuthenticationApi.LoginSnapTradeUserRequestBuilder) this; + } + + /** + * Build call for loginSnapTradeUser + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Login successful. Redirect user to provided URI in response -
500 Unexpected Error -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + SnapTradeLoginUserRequestBody snapTradeLoginUserRequestBody = buildBodyParams(); + return loginSnapTradeUserCall(userId, userSecret, snapTradeLoginUserRequestBody, _callback); + } + + private SnapTradeLoginUserRequestBody buildBodyParams() { + SnapTradeLoginUserRequestBody snapTradeLoginUserRequestBody = new SnapTradeLoginUserRequestBody(); + snapTradeLoginUserRequestBody.broker(this.broker); + snapTradeLoginUserRequestBody.immediateRedirect(this.immediateRedirect); + snapTradeLoginUserRequestBody.customRedirect(this.customRedirect); + snapTradeLoginUserRequestBody.reconnect(this.reconnect); + if (this.connectionType != null) + snapTradeLoginUserRequestBody.connectionType(SnapTradeLoginUserRequestBody.ConnectionTypeEnum.fromValue(this.connectionType)); + if (this.connectionPortalVersion != null) + snapTradeLoginUserRequestBody.connectionPortalVersion(SnapTradeLoginUserRequestBody.ConnectionPortalVersionEnum.fromValue(this.connectionPortalVersion)); + return snapTradeLoginUserRequestBody; + } + + /** + * Execute loginSnapTradeUser request + * @return Object + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Login successful. Redirect user to provided URI in response -
500 Unexpected Error -
+ */ + public Object execute() throws ApiException { + SnapTradeLoginUserRequestBody snapTradeLoginUserRequestBody = buildBodyParams(); + ApiResponse localVarResp = loginSnapTradeUserWithHttpInfo(userId, userSecret, snapTradeLoginUserRequestBody); + return localVarResp.getResponseBody(); + } + + /** + * Execute loginSnapTradeUser request with HTTP info returned + * @return ApiResponse<Object> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Login successful. Redirect user to provided URI in response -
500 Unexpected Error -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + SnapTradeLoginUserRequestBody snapTradeLoginUserRequestBody = buildBodyParams(); + return loginSnapTradeUserWithHttpInfo(userId, userSecret, snapTradeLoginUserRequestBody); + } + + /** + * Execute loginSnapTradeUser request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Login successful. Redirect user to provided URI in response -
500 Unexpected Error -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + SnapTradeLoginUserRequestBody snapTradeLoginUserRequestBody = buildBodyParams(); + return loginSnapTradeUserAsync(userId, userSecret, snapTradeLoginUserRequestBody, _callback); + } + } + + /** + * Login user & generate connection link + * Logs in a SnapTrade user and returns an authenticated connection portal URL for them to use to connect a brokerage account. + * @param userId (required) + * @param userSecret (required) + * @return LoginSnapTradeUserRequestBuilder + * @http.response.details + + + + +
Status Code Description Response Headers
200 Login successful. Redirect user to provided URI in response -
500 Unexpected Error -
+ */ + public AuthenticationApi.LoginSnapTradeUserRequestBuilder loginSnapTradeUser(String userId, String userSecret) throws IllegalArgumentException { + if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null"); + + + if (userSecret == null) throw new IllegalArgumentException("\"userSecret\" is required but got null"); + + + return ((AuthenticationApi) this).new LoginSnapTradeUserRequestBuilder(userId, userSecret); + } + private okhttp3.Call registerSnapTradeUserCall(SnapTradeRegisterUserRequestBody snapTradeRegisterUserRequestBody, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = snapTradeRegisterUserRequestBody; + + // create path and map variables + String localVarPath = "/snapTrade/registerUser"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call registerSnapTradeUserValidateBeforeCall(SnapTradeRegisterUserRequestBody snapTradeRegisterUserRequestBody, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'snapTradeRegisterUserRequestBody' is set + if (snapTradeRegisterUserRequestBody == null) { + throw new ApiException("Missing the required parameter 'snapTradeRegisterUserRequestBody' when calling registerSnapTradeUser(Async)"); + } + + return registerSnapTradeUserCall(snapTradeRegisterUserRequestBody, _callback); + + } + + + private ApiResponse registerSnapTradeUserWithHttpInfo(SnapTradeRegisterUserRequestBody snapTradeRegisterUserRequestBody) throws ApiException { + okhttp3.Call localVarCall = registerSnapTradeUserValidateBeforeCall(snapTradeRegisterUserRequestBody, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call registerSnapTradeUserAsync(SnapTradeRegisterUserRequestBody snapTradeRegisterUserRequestBody, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = registerSnapTradeUserValidateBeforeCall(snapTradeRegisterUserRequestBody, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class RegisterSnapTradeUserRequestBuilderGenerated { + String userId; + + public RegisterSnapTradeUserRequestBuilderGenerated() { + } + + /** + * Set userId + * @param userId SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable. (optional) + * @return AuthenticationApi.RegisterSnapTradeUserRequestBuilder + */ + public AuthenticationApi.RegisterSnapTradeUserRequestBuilder userId(String userId) { + this.userId = userId; + return (AuthenticationApi.RegisterSnapTradeUserRequestBuilder) this; + } + + /** + * Build call for registerSnapTradeUser + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successfully registered user -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + SnapTradeRegisterUserRequestBody snapTradeRegisterUserRequestBody = buildBodyParams(); + return registerSnapTradeUserCall(snapTradeRegisterUserRequestBody, _callback); + } + + private SnapTradeRegisterUserRequestBody buildBodyParams() { + SnapTradeRegisterUserRequestBody snapTradeRegisterUserRequestBody = new SnapTradeRegisterUserRequestBody(); + snapTradeRegisterUserRequestBody.userId(this.userId); + return snapTradeRegisterUserRequestBody; + } + + /** + * Execute registerSnapTradeUser request + * @return UserIDandSecret + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successfully registered user -
+ */ + public UserIDandSecret execute() throws ApiException { + SnapTradeRegisterUserRequestBody snapTradeRegisterUserRequestBody = buildBodyParams(); + ApiResponse localVarResp = registerSnapTradeUserWithHttpInfo(snapTradeRegisterUserRequestBody); + return localVarResp.getResponseBody(); + } + + /** + * Execute registerSnapTradeUser request with HTTP info returned + * @return ApiResponse<UserIDandSecret> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Successfully registered user -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + SnapTradeRegisterUserRequestBody snapTradeRegisterUserRequestBody = buildBodyParams(); + return registerSnapTradeUserWithHttpInfo(snapTradeRegisterUserRequestBody); + } + + /** + * Execute registerSnapTradeUser request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Successfully registered user -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + SnapTradeRegisterUserRequestBody snapTradeRegisterUserRequestBody = buildBodyParams(); + return registerSnapTradeUserAsync(snapTradeRegisterUserRequestBody, _callback); + } + } + + /** + * Create SnapTrade user + * Registers a new SnapTrade user under your ClientID. A user secret will be automatically generated for you and must be properly stored in your database. Most SnapTrade operations require a user ID and user secret to be passed as a parameter. + * @param snapTradeRegisterUserRequestBody (required) + * @return RegisterSnapTradeUserRequestBuilder + * @http.response.details + + + +
Status Code Description Response Headers
200 Successfully registered user -
+ */ + public AuthenticationApi.RegisterSnapTradeUserRequestBuilder registerSnapTradeUser() throws IllegalArgumentException { + return ((AuthenticationApi) this).new RegisterSnapTradeUserRequestBuilder(); + } + private okhttp3.Call resetSnapTradeUserSecretCall(UserIDandSecret userIDandSecret, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = userIDandSecret; + + // create path and map variables + String localVarPath = "/snapTrade/resetUserSecret"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call resetSnapTradeUserSecretValidateBeforeCall(UserIDandSecret userIDandSecret, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'userIDandSecret' is set + if (userIDandSecret == null) { + throw new ApiException("Missing the required parameter 'userIDandSecret' when calling resetSnapTradeUserSecret(Async)"); + } + + return resetSnapTradeUserSecretCall(userIDandSecret, _callback); + + } + + + private ApiResponse resetSnapTradeUserSecretWithHttpInfo(UserIDandSecret userIDandSecret) throws ApiException { + okhttp3.Call localVarCall = resetSnapTradeUserSecretValidateBeforeCall(userIDandSecret, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call resetSnapTradeUserSecretAsync(UserIDandSecret userIDandSecret, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = resetSnapTradeUserSecretValidateBeforeCall(userIDandSecret, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class ResetSnapTradeUserSecretRequestBuilderGenerated { + String userId; + String userSecret; + + public ResetSnapTradeUserSecretRequestBuilderGenerated() { + } + + /** + * Set userId + * @param userId SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable. (optional) + * @return AuthenticationApi.ResetSnapTradeUserSecretRequestBuilder + */ + public AuthenticationApi.ResetSnapTradeUserSecretRequestBuilder userId(String userId) { + this.userId = userId; + return (AuthenticationApi.ResetSnapTradeUserSecretRequestBuilder) this; + } + + /** + * Set userSecret + * @param userSecret SnapTrade User Secret randomly generated by SnapTrade. This is privileged information and if compromised, should be rotated via the SnapTrade API. (optional) + * @return AuthenticationApi.ResetSnapTradeUserSecretRequestBuilder + */ + public AuthenticationApi.ResetSnapTradeUserSecretRequestBuilder userSecret(String userSecret) { + this.userSecret = userSecret; + return (AuthenticationApi.ResetSnapTradeUserSecretRequestBuilder) this; + } + + /** + * Build call for resetSnapTradeUserSecret + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 New user secret is generated -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + UserIDandSecret userIDandSecret = buildBodyParams(); + return resetSnapTradeUserSecretCall(userIDandSecret, _callback); + } + + private UserIDandSecret buildBodyParams() { + UserIDandSecret userIDandSecret = new UserIDandSecret(); + userIDandSecret.userId(this.userId); + userIDandSecret.userSecret(this.userSecret); + return userIDandSecret; + } + + /** + * Execute resetSnapTradeUserSecret request + * @return UserIDandSecret + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 New user secret is generated -
+ */ + public UserIDandSecret execute() throws ApiException { + UserIDandSecret userIDandSecret = buildBodyParams(); + ApiResponse localVarResp = resetSnapTradeUserSecretWithHttpInfo(userIDandSecret); + return localVarResp.getResponseBody(); + } + + /** + * Execute resetSnapTradeUserSecret request with HTTP info returned + * @return ApiResponse<UserIDandSecret> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 New user secret is generated -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + UserIDandSecret userIDandSecret = buildBodyParams(); + return resetSnapTradeUserSecretWithHttpInfo(userIDandSecret); + } + + /** + * Execute resetSnapTradeUserSecret request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 New user secret is generated -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + UserIDandSecret userIDandSecret = buildBodyParams(); + return resetSnapTradeUserSecretAsync(userIDandSecret, _callback); + } + } + + /** + * Obtain a new user secret for a user + * This API is used to rotate the secret for a SnapTrade user. You might use this if a userSecret is compromised. Please note that if you call this endpoint and fail to save the new secret, you'll no longer be able to access any data for this user, and your only option will be to delete and recreate the user, then ask them to reconnect. + * @param userIDandSecret (required) + * @return ResetSnapTradeUserSecretRequestBuilder + * @http.response.details + + + +
Status Code Description Response Headers
200 New user secret is generated -
+ */ + public AuthenticationApi.ResetSnapTradeUserSecretRequestBuilder resetSnapTradeUserSecret() throws IllegalArgumentException { + return ((AuthenticationApi) this).new ResetSnapTradeUserSecretRequestBuilder(); + } +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/ConnectionsApi.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/ConnectionsApi.java new file mode 100644 index 0000000000..928e334a1b --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/ConnectionsApi.java @@ -0,0 +1,49 @@ +package com.konfigthis.client.api; + +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.model.BrokerageAuthorization; +import com.konfigthis.client.model.BrokerageAuthorizationDisabledConfirmation; +import com.konfigthis.client.model.BrokerageAuthorizationRefreshConfirmation; +import com.konfigthis.client.model.SessionEvent; +import java.util.UUID; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ConnectionsApi extends ConnectionsApiGenerated { + + public ConnectionsApi(ApiClient apiClient) throws IllegalArgumentException { + super(apiClient); + } + public class DetailBrokerageAuthorizationRequestBuilder extends DetailBrokerageAuthorizationRequestBuilderGenerated { + public DetailBrokerageAuthorizationRequestBuilder(UUID authorizationId, String userId, String userSecret) { + super(authorizationId, userId, userSecret); + } + } + public class DisableBrokerageAuthorizationRequestBuilder extends DisableBrokerageAuthorizationRequestBuilderGenerated { + public DisableBrokerageAuthorizationRequestBuilder(UUID authorizationId, String userId, String userSecret) { + super(authorizationId, userId, userSecret); + } + } + public class ListBrokerageAuthorizationsRequestBuilder extends ListBrokerageAuthorizationsRequestBuilderGenerated { + public ListBrokerageAuthorizationsRequestBuilder(String userId, String userSecret) { + super(userId, userSecret); + } + } + public class RefreshBrokerageAuthorizationRequestBuilder extends RefreshBrokerageAuthorizationRequestBuilderGenerated { + public RefreshBrokerageAuthorizationRequestBuilder(UUID authorizationId, String userId, String userSecret) { + super(authorizationId, userId, userSecret); + } + } + public class RemoveBrokerageAuthorizationRequestBuilder extends RemoveBrokerageAuthorizationRequestBuilderGenerated { + public RemoveBrokerageAuthorizationRequestBuilder(UUID authorizationId, String userId, String userSecret) { + super(authorizationId, userId, userSecret); + } + } + public class SessionEventsRequestBuilder extends SessionEventsRequestBuilderGenerated { + public SessionEventsRequestBuilder(String partnerClientId) { + super(partnerClientId); + } + } +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/ConnectionsApiGenerated.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/ConnectionsApiGenerated.java new file mode 100644 index 0000000000..550f071e0c --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/ConnectionsApiGenerated.java @@ -0,0 +1,1211 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.api; + +import com.konfigthis.client.ApiCallback; +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.Pair; +import com.konfigthis.client.ProgressRequestBody; +import com.konfigthis.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.konfigthis.client.model.BrokerageAuthorization; +import com.konfigthis.client.model.BrokerageAuthorizationDisabledConfirmation; +import com.konfigthis.client.model.BrokerageAuthorizationRefreshConfirmation; +import com.konfigthis.client.model.SessionEvent; +import java.util.UUID; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.ws.rs.core.GenericType; + +public class ConnectionsApiGenerated { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public ConnectionsApiGenerated() throws IllegalArgumentException { + this(Configuration.getDefaultApiClient()); + } + + public ConnectionsApiGenerated(ApiClient apiClient) throws IllegalArgumentException { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + private okhttp3.Call detailBrokerageAuthorizationCall(UUID authorizationId, String userId, String userSecret, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/authorizations/{authorizationId}" + .replace("{" + "authorizationId" + "}", localVarApiClient.escapeString(authorizationId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (userId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userId", userId)); + } + + if (userSecret != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userSecret", userSecret)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call detailBrokerageAuthorizationValidateBeforeCall(UUID authorizationId, String userId, String userSecret, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'authorizationId' is set + if (authorizationId == null) { + throw new ApiException("Missing the required parameter 'authorizationId' when calling detailBrokerageAuthorization(Async)"); + } + + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException("Missing the required parameter 'userId' when calling detailBrokerageAuthorization(Async)"); + } + + // verify the required parameter 'userSecret' is set + if (userSecret == null) { + throw new ApiException("Missing the required parameter 'userSecret' when calling detailBrokerageAuthorization(Async)"); + } + + return detailBrokerageAuthorizationCall(authorizationId, userId, userSecret, _callback); + + } + + + private ApiResponse detailBrokerageAuthorizationWithHttpInfo(UUID authorizationId, String userId, String userSecret) throws ApiException { + okhttp3.Call localVarCall = detailBrokerageAuthorizationValidateBeforeCall(authorizationId, userId, userSecret, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call detailBrokerageAuthorizationAsync(UUID authorizationId, String userId, String userSecret, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = detailBrokerageAuthorizationValidateBeforeCall(authorizationId, userId, userSecret, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class DetailBrokerageAuthorizationRequestBuilderGenerated { + final UUID authorizationId; + final String userId; + final String userSecret; + + public DetailBrokerageAuthorizationRequestBuilderGenerated(UUID authorizationId, String userId, String userSecret) { + this.authorizationId = authorizationId; + this.userId = userId; + this.userSecret = userSecret; + } + + /** + * Build call for detailBrokerageAuthorization + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Authorization object for the authenticated user. -
0 Unexpected error. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return detailBrokerageAuthorizationCall(authorizationId, userId, userSecret, _callback); + } + + + /** + * Execute detailBrokerageAuthorization request + * @return BrokerageAuthorization + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Authorization object for the authenticated user. -
0 Unexpected error. -
+ */ + public BrokerageAuthorization execute() throws ApiException { + ApiResponse localVarResp = detailBrokerageAuthorizationWithHttpInfo(authorizationId, userId, userSecret); + return localVarResp.getResponseBody(); + } + + /** + * Execute detailBrokerageAuthorization request with HTTP info returned + * @return ApiResponse<BrokerageAuthorization> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Authorization object for the authenticated user. -
0 Unexpected error. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return detailBrokerageAuthorizationWithHttpInfo(authorizationId, userId, userSecret); + } + + /** + * Execute detailBrokerageAuthorization request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Authorization object for the authenticated user. -
0 Unexpected error. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return detailBrokerageAuthorizationAsync(authorizationId, userId, userSecret, _callback); + } + } + + /** + * Get brokerage authorization details + * Returns a single brokerage authorization object for the specified ID. + * @param authorizationId The ID of a brokerage authorization object. (required) + * @param userId (required) + * @param userSecret (required) + * @return DetailBrokerageAuthorizationRequestBuilder + * @http.response.details + + + + +
Status Code Description Response Headers
200 Authorization object for the authenticated user. -
0 Unexpected error. -
+ */ + public ConnectionsApi.DetailBrokerageAuthorizationRequestBuilder detailBrokerageAuthorization(UUID authorizationId, String userId, String userSecret) throws IllegalArgumentException { + if (authorizationId == null) throw new IllegalArgumentException("\"authorizationId\" is required but got null"); + + + if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null"); + + + if (userSecret == null) throw new IllegalArgumentException("\"userSecret\" is required but got null"); + + + return ((ConnectionsApi) this).new DetailBrokerageAuthorizationRequestBuilder(authorizationId, userId, userSecret); + } + private okhttp3.Call disableBrokerageAuthorizationCall(UUID authorizationId, String userId, String userSecret, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/authorizations/{authorizationId}/disable" + .replace("{" + "authorizationId" + "}", localVarApiClient.escapeString(authorizationId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (userId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userId", userId)); + } + + if (userSecret != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userSecret", userSecret)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call disableBrokerageAuthorizationValidateBeforeCall(UUID authorizationId, String userId, String userSecret, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'authorizationId' is set + if (authorizationId == null) { + throw new ApiException("Missing the required parameter 'authorizationId' when calling disableBrokerageAuthorization(Async)"); + } + + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException("Missing the required parameter 'userId' when calling disableBrokerageAuthorization(Async)"); + } + + // verify the required parameter 'userSecret' is set + if (userSecret == null) { + throw new ApiException("Missing the required parameter 'userSecret' when calling disableBrokerageAuthorization(Async)"); + } + + return disableBrokerageAuthorizationCall(authorizationId, userId, userSecret, _callback); + + } + + + private ApiResponse disableBrokerageAuthorizationWithHttpInfo(UUID authorizationId, String userId, String userSecret) throws ApiException { + okhttp3.Call localVarCall = disableBrokerageAuthorizationValidateBeforeCall(authorizationId, userId, userSecret, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call disableBrokerageAuthorizationAsync(UUID authorizationId, String userId, String userSecret, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = disableBrokerageAuthorizationValidateBeforeCall(authorizationId, userId, userSecret, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class DisableBrokerageAuthorizationRequestBuilderGenerated { + final UUID authorizationId; + final String userId; + final String userSecret; + + public DisableBrokerageAuthorizationRequestBuilderGenerated(UUID authorizationId, String userId, String userSecret) { + this.authorizationId = authorizationId; + this.userId = userId; + this.userSecret = userSecret; + } + + /** + * Build call for disableBrokerageAuthorization + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Confirmation that the connection has been disabled -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return disableBrokerageAuthorizationCall(authorizationId, userId, userSecret, _callback); + } + + + /** + * Execute disableBrokerageAuthorization request + * @return BrokerageAuthorizationDisabledConfirmation + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Confirmation that the connection has been disabled -
+ */ + public BrokerageAuthorizationDisabledConfirmation execute() throws ApiException { + ApiResponse localVarResp = disableBrokerageAuthorizationWithHttpInfo(authorizationId, userId, userSecret); + return localVarResp.getResponseBody(); + } + + /** + * Execute disableBrokerageAuthorization request with HTTP info returned + * @return ApiResponse<BrokerageAuthorizationDisabledConfirmation> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Confirmation that the connection has been disabled -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return disableBrokerageAuthorizationWithHttpInfo(authorizationId, userId, userSecret); + } + + /** + * Execute disableBrokerageAuthorization request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Confirmation that the connection has been disabled -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return disableBrokerageAuthorizationAsync(authorizationId, userId, userSecret, _callback); + } + } + + /** + * Manually disable a connection for testing + * Manually disable a connection. This should only be used for testing a reconnect flow, and never used on production connections. Will trigger a disconnect as if it happened naturally, and send a CONNECTION_BROKEN webhook for the connection. Please contact us in order to use this endpoint as it is disabled by default. + * @param authorizationId The ID of a brokerage authorization object. (required) + * @param userId (required) + * @param userSecret (required) + * @return DisableBrokerageAuthorizationRequestBuilder + * @http.response.details + + + +
Status Code Description Response Headers
200 Confirmation that the connection has been disabled -
+ */ + public ConnectionsApi.DisableBrokerageAuthorizationRequestBuilder disableBrokerageAuthorization(UUID authorizationId, String userId, String userSecret) throws IllegalArgumentException { + if (authorizationId == null) throw new IllegalArgumentException("\"authorizationId\" is required but got null"); + + + if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null"); + + + if (userSecret == null) throw new IllegalArgumentException("\"userSecret\" is required but got null"); + + + return ((ConnectionsApi) this).new DisableBrokerageAuthorizationRequestBuilder(authorizationId, userId, userSecret); + } + private okhttp3.Call listBrokerageAuthorizationsCall(String userId, String userSecret, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/authorizations"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (userId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userId", userId)); + } + + if (userSecret != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userSecret", userSecret)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listBrokerageAuthorizationsValidateBeforeCall(String userId, String userSecret, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException("Missing the required parameter 'userId' when calling listBrokerageAuthorizations(Async)"); + } + + // verify the required parameter 'userSecret' is set + if (userSecret == null) { + throw new ApiException("Missing the required parameter 'userSecret' when calling listBrokerageAuthorizations(Async)"); + } + + return listBrokerageAuthorizationsCall(userId, userSecret, _callback); + + } + + + private ApiResponse> listBrokerageAuthorizationsWithHttpInfo(String userId, String userSecret) throws ApiException { + okhttp3.Call localVarCall = listBrokerageAuthorizationsValidateBeforeCall(userId, userSecret, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call listBrokerageAuthorizationsAsync(String userId, String userSecret, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = listBrokerageAuthorizationsValidateBeforeCall(userId, userSecret, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class ListBrokerageAuthorizationsRequestBuilderGenerated { + final String userId; + final String userSecret; + + public ListBrokerageAuthorizationsRequestBuilderGenerated(String userId, String userSecret) { + this.userId = userId; + this.userSecret = userSecret; + } + + /** + * Build call for listBrokerageAuthorizations + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of all Authorization objects for the authenticated user. -
0 Unexpected error. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return listBrokerageAuthorizationsCall(userId, userSecret, _callback); + } + + + /** + * Execute listBrokerageAuthorizations request + * @return List<BrokerageAuthorization> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of all Authorization objects for the authenticated user. -
0 Unexpected error. -
+ */ + public List execute() throws ApiException { + ApiResponse> localVarResp = listBrokerageAuthorizationsWithHttpInfo(userId, userSecret); + return localVarResp.getResponseBody(); + } + + /** + * Execute listBrokerageAuthorizations request with HTTP info returned + * @return ApiResponse<List<BrokerageAuthorization>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of all Authorization objects for the authenticated user. -
0 Unexpected error. -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + return listBrokerageAuthorizationsWithHttpInfo(userId, userSecret); + } + + /** + * Execute listBrokerageAuthorizations request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of all Authorization objects for the authenticated user. -
0 Unexpected error. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return listBrokerageAuthorizationsAsync(userId, userSecret, _callback); + } + } + + /** + * List all brokerage authorizations for the User + * Returns a list of Brokerage Authorization objects for the user + * @param userId (required) + * @param userSecret (required) + * @return ListBrokerageAuthorizationsRequestBuilder + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of all Authorization objects for the authenticated user. -
0 Unexpected error. -
+ */ + public ConnectionsApi.ListBrokerageAuthorizationsRequestBuilder listBrokerageAuthorizations(String userId, String userSecret) throws IllegalArgumentException { + if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null"); + + + if (userSecret == null) throw new IllegalArgumentException("\"userSecret\" is required but got null"); + + + return ((ConnectionsApi) this).new ListBrokerageAuthorizationsRequestBuilder(userId, userSecret); + } + private okhttp3.Call refreshBrokerageAuthorizationCall(UUID authorizationId, String userId, String userSecret, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/authorizations/{authorizationId}/refresh" + .replace("{" + "authorizationId" + "}", localVarApiClient.escapeString(authorizationId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (userId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userId", userId)); + } + + if (userSecret != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userSecret", userSecret)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call refreshBrokerageAuthorizationValidateBeforeCall(UUID authorizationId, String userId, String userSecret, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'authorizationId' is set + if (authorizationId == null) { + throw new ApiException("Missing the required parameter 'authorizationId' when calling refreshBrokerageAuthorization(Async)"); + } + + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException("Missing the required parameter 'userId' when calling refreshBrokerageAuthorization(Async)"); + } + + // verify the required parameter 'userSecret' is set + if (userSecret == null) { + throw new ApiException("Missing the required parameter 'userSecret' when calling refreshBrokerageAuthorization(Async)"); + } + + return refreshBrokerageAuthorizationCall(authorizationId, userId, userSecret, _callback); + + } + + + private ApiResponse refreshBrokerageAuthorizationWithHttpInfo(UUID authorizationId, String userId, String userSecret) throws ApiException { + okhttp3.Call localVarCall = refreshBrokerageAuthorizationValidateBeforeCall(authorizationId, userId, userSecret, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call refreshBrokerageAuthorizationAsync(UUID authorizationId, String userId, String userSecret, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = refreshBrokerageAuthorizationValidateBeforeCall(authorizationId, userId, userSecret, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class RefreshBrokerageAuthorizationRequestBuilderGenerated { + final UUID authorizationId; + final String userId; + final String userSecret; + + public RefreshBrokerageAuthorizationRequestBuilderGenerated(UUID authorizationId, String userId, String userSecret) { + this.authorizationId = authorizationId; + this.userId = userId; + this.userSecret = userSecret; + } + + /** + * Build call for refreshBrokerageAuthorization + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Confirmation that the syncs have been scheduled -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return refreshBrokerageAuthorizationCall(authorizationId, userId, userSecret, _callback); + } + + + /** + * Execute refreshBrokerageAuthorization request + * @return BrokerageAuthorizationRefreshConfirmation + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Confirmation that the syncs have been scheduled -
+ */ + public BrokerageAuthorizationRefreshConfirmation execute() throws ApiException { + ApiResponse localVarResp = refreshBrokerageAuthorizationWithHttpInfo(authorizationId, userId, userSecret); + return localVarResp.getResponseBody(); + } + + /** + * Execute refreshBrokerageAuthorization request with HTTP info returned + * @return ApiResponse<BrokerageAuthorizationRefreshConfirmation> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Confirmation that the syncs have been scheduled -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return refreshBrokerageAuthorizationWithHttpInfo(authorizationId, userId, userSecret); + } + + /** + * Execute refreshBrokerageAuthorization request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Confirmation that the syncs have been scheduled -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return refreshBrokerageAuthorizationAsync(authorizationId, userId, userSecret, _callback); + } + } + + /** + * Refresh holdings for a connection + * Trigger a holdings update for all accounts under this authorization. Updates will be queued asynchronously. ACCOUNT_HOLDINGS_UPDATED webhook will be sent once the sync completes. Please contact support for access as this endpoint is not enabled by default + * @param authorizationId The ID of a brokerage authorization object. (required) + * @param userId (required) + * @param userSecret (required) + * @return RefreshBrokerageAuthorizationRequestBuilder + * @http.response.details + + + +
Status Code Description Response Headers
200 Confirmation that the syncs have been scheduled -
+ */ + public ConnectionsApi.RefreshBrokerageAuthorizationRequestBuilder refreshBrokerageAuthorization(UUID authorizationId, String userId, String userSecret) throws IllegalArgumentException { + if (authorizationId == null) throw new IllegalArgumentException("\"authorizationId\" is required but got null"); + + + if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null"); + + + if (userSecret == null) throw new IllegalArgumentException("\"userSecret\" is required but got null"); + + + return ((ConnectionsApi) this).new RefreshBrokerageAuthorizationRequestBuilder(authorizationId, userId, userSecret); + } + private okhttp3.Call removeBrokerageAuthorizationCall(UUID authorizationId, String userId, String userSecret, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/authorizations/{authorizationId}" + .replace("{" + "authorizationId" + "}", localVarApiClient.escapeString(authorizationId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (userId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userId", userId)); + } + + if (userSecret != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userSecret", userSecret)); + } + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call removeBrokerageAuthorizationValidateBeforeCall(UUID authorizationId, String userId, String userSecret, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'authorizationId' is set + if (authorizationId == null) { + throw new ApiException("Missing the required parameter 'authorizationId' when calling removeBrokerageAuthorization(Async)"); + } + + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException("Missing the required parameter 'userId' when calling removeBrokerageAuthorization(Async)"); + } + + // verify the required parameter 'userSecret' is set + if (userSecret == null) { + throw new ApiException("Missing the required parameter 'userSecret' when calling removeBrokerageAuthorization(Async)"); + } + + return removeBrokerageAuthorizationCall(authorizationId, userId, userSecret, _callback); + + } + + + private ApiResponse removeBrokerageAuthorizationWithHttpInfo(UUID authorizationId, String userId, String userSecret) throws ApiException { + okhttp3.Call localVarCall = removeBrokerageAuthorizationValidateBeforeCall(authorizationId, userId, userSecret, null); + return localVarApiClient.execute(localVarCall); + } + + private okhttp3.Call removeBrokerageAuthorizationAsync(UUID authorizationId, String userId, String userSecret, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = removeBrokerageAuthorizationValidateBeforeCall(authorizationId, userId, userSecret, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + public abstract class RemoveBrokerageAuthorizationRequestBuilderGenerated { + final UUID authorizationId; + final String userId; + final String userSecret; + + public RemoveBrokerageAuthorizationRequestBuilderGenerated(UUID authorizationId, String userId, String userSecret) { + this.authorizationId = authorizationId; + this.userId = userId; + this.userSecret = userSecret; + } + + /** + * Build call for removeBrokerageAuthorization + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Brokerage authorization object has been successfully deleted -
400 The specified authorizationId is invalid (not a UUID string). -
404 The specified authorizationId was not found. -
0 Unexpected error. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return removeBrokerageAuthorizationCall(authorizationId, userId, userSecret, _callback); + } + + + /** + * Execute removeBrokerageAuthorization request + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Brokerage authorization object has been successfully deleted -
400 The specified authorizationId is invalid (not a UUID string). -
404 The specified authorizationId was not found. -
0 Unexpected error. -
+ */ + public void execute() throws ApiException { + removeBrokerageAuthorizationWithHttpInfo(authorizationId, userId, userSecret); + } + + /** + * Execute removeBrokerageAuthorization request with HTTP info returned + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Brokerage authorization object has been successfully deleted -
400 The specified authorizationId is invalid (not a UUID string). -
404 The specified authorizationId was not found. -
0 Unexpected error. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return removeBrokerageAuthorizationWithHttpInfo(authorizationId, userId, userSecret); + } + + /** + * Execute removeBrokerageAuthorization request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Brokerage authorization object has been successfully deleted -
400 The specified authorizationId is invalid (not a UUID string). -
404 The specified authorizationId was not found. -
0 Unexpected error. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return removeBrokerageAuthorizationAsync(authorizationId, userId, userSecret, _callback); + } + } + + /** + * Delete brokerage authorization + * Deletes a specified brokerage authorization given by the ID. + * @param authorizationId The ID of the Authorization to delete. (required) + * @param userId (required) + * @param userSecret (required) + * @return RemoveBrokerageAuthorizationRequestBuilder + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Brokerage authorization object has been successfully deleted -
400 The specified authorizationId is invalid (not a UUID string). -
404 The specified authorizationId was not found. -
0 Unexpected error. -
+ */ + public ConnectionsApi.RemoveBrokerageAuthorizationRequestBuilder removeBrokerageAuthorization(UUID authorizationId, String userId, String userSecret) throws IllegalArgumentException { + if (authorizationId == null) throw new IllegalArgumentException("\"authorizationId\" is required but got null"); + + + if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null"); + + + if (userSecret == null) throw new IllegalArgumentException("\"userSecret\" is required but got null"); + + + return ((ConnectionsApi) this).new RemoveBrokerageAuthorizationRequestBuilder(authorizationId, userId, userSecret); + } + private okhttp3.Call sessionEventsCall(String partnerClientId, String userId, String sessionId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sessionEvents"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (partnerClientId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("PartnerClientId", partnerClientId)); + } + + if (userId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userId", userId)); + } + + if (sessionId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sessionId", sessionId)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call sessionEventsValidateBeforeCall(String partnerClientId, String userId, String sessionId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'partnerClientId' is set + if (partnerClientId == null) { + throw new ApiException("Missing the required parameter 'partnerClientId' when calling sessionEvents(Async)"); + } + + return sessionEventsCall(partnerClientId, userId, sessionId, _callback); + + } + + + private ApiResponse> sessionEventsWithHttpInfo(String partnerClientId, String userId, String sessionId) throws ApiException { + okhttp3.Call localVarCall = sessionEventsValidateBeforeCall(partnerClientId, userId, sessionId, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call sessionEventsAsync(String partnerClientId, String userId, String sessionId, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = sessionEventsValidateBeforeCall(partnerClientId, userId, sessionId, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class SessionEventsRequestBuilderGenerated { + final String partnerClientId; + String userId; + String sessionId; + + public SessionEventsRequestBuilderGenerated(String partnerClientId) { + this.partnerClientId = partnerClientId; + } + + /** + * Set userId + * @param userId Optional comma seperated list of user IDs used to filter the request on specific users (optional) + * @return ConnectionsApi.SessionEventsRequestBuilder + */ + public ConnectionsApi.SessionEventsRequestBuilder userId(String userId) { + this.userId = userId; + return (ConnectionsApi.SessionEventsRequestBuilder) this; + } + + /** + * Set sessionId + * @param sessionId Optional comma seperated list of session IDs used to filter the request on specific users (optional) + * @return ConnectionsApi.SessionEventsRequestBuilder + */ + public ConnectionsApi.SessionEventsRequestBuilder sessionId(String sessionId) { + this.sessionId = sessionId; + return (ConnectionsApi.SessionEventsRequestBuilder) this; + } + + /** + * Build call for sessionEvents + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of all Session Events for the Partner. -
0 Unexpected error. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return sessionEventsCall(partnerClientId, userId, sessionId, _callback); + } + + + /** + * Execute sessionEvents request + * @return List<SessionEvent> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of all Session Events for the Partner. -
0 Unexpected error. -
+ */ + public List execute() throws ApiException { + ApiResponse> localVarResp = sessionEventsWithHttpInfo(partnerClientId, userId, sessionId); + return localVarResp.getResponseBody(); + } + + /** + * Execute sessionEvents request with HTTP info returned + * @return ApiResponse<List<SessionEvent>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of all Session Events for the Partner. -
0 Unexpected error. -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + return sessionEventsWithHttpInfo(partnerClientId, userId, sessionId); + } + + /** + * Execute sessionEvents request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of all Session Events for the Partner. -
0 Unexpected error. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return sessionEventsAsync(partnerClientId, userId, sessionId, _callback); + } + } + + /** + * Get all session events for a user + * Returns a list of session events associated with a user. + * @param partnerClientId (required) + * @return SessionEventsRequestBuilder + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of all Session Events for the Partner. -
0 Unexpected error. -
+ */ + public ConnectionsApi.SessionEventsRequestBuilder sessionEvents(String partnerClientId) throws IllegalArgumentException { + if (partnerClientId == null) throw new IllegalArgumentException("\"partnerClientId\" is required but got null"); + + + return ((ConnectionsApi) this).new SessionEventsRequestBuilder(partnerClientId); + } +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/OptionsApi.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/OptionsApi.java new file mode 100644 index 0000000000..904f643bdf --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/OptionsApi.java @@ -0,0 +1,49 @@ +package com.konfigthis.client.api; + +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.model.OptionChainInner; +import com.konfigthis.client.model.OptionLeg; +import com.konfigthis.client.model.OptionsGetOptionStrategyRequest; +import com.konfigthis.client.model.OptionsPlaceOptionStrategyRequest; +import com.konfigthis.client.model.OptionsPosition; +import com.konfigthis.client.model.OrderTypeStrict; +import com.konfigthis.client.model.StrategyOrderRecord; +import com.konfigthis.client.model.StrategyQuotes; +import com.konfigthis.client.model.TimeInForceStrict; +import java.util.UUID; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class OptionsApi extends OptionsApiGenerated { + + public OptionsApi(ApiClient apiClient) throws IllegalArgumentException { + super(apiClient); + } + public class GetOptionStrategyRequestBuilder extends GetOptionStrategyRequestBuilderGenerated { + public GetOptionStrategyRequestBuilder(UUID underlyingSymbolId, List legs, String strategyType, String userId, String userSecret, UUID accountId) { + super(underlyingSymbolId, legs, strategyType, userId, userSecret, accountId); + } + } + public class GetOptionsChainRequestBuilder extends GetOptionsChainRequestBuilderGenerated { + public GetOptionsChainRequestBuilder(String userId, String userSecret, UUID accountId, UUID symbol) { + super(userId, userSecret, accountId, symbol); + } + } + public class GetOptionsStrategyQuoteRequestBuilder extends GetOptionsStrategyQuoteRequestBuilderGenerated { + public GetOptionsStrategyQuoteRequestBuilder(String userId, String userSecret, UUID accountId, UUID optionStrategyId) { + super(userId, userSecret, accountId, optionStrategyId); + } + } + public class ListOptionHoldingsRequestBuilder extends ListOptionHoldingsRequestBuilderGenerated { + public ListOptionHoldingsRequestBuilder(String userId, String userSecret, UUID accountId) { + super(userId, userSecret, accountId); + } + } + public class PlaceOptionStrategyRequestBuilder extends PlaceOptionStrategyRequestBuilderGenerated { + public PlaceOptionStrategyRequestBuilder(OrderTypeStrict orderType, TimeInForceStrict timeInForce, String userId, String userSecret, UUID accountId, UUID optionStrategyId) { + super(orderType, timeInForce, userId, userSecret, accountId, optionStrategyId); + } + } +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/OptionsApiGenerated.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/OptionsApiGenerated.java new file mode 100644 index 0000000000..10a1424d34 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/OptionsApiGenerated.java @@ -0,0 +1,1131 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.api; + +import com.konfigthis.client.ApiCallback; +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.Pair; +import com.konfigthis.client.ProgressRequestBody; +import com.konfigthis.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.konfigthis.client.model.OptionChainInner; +import com.konfigthis.client.model.OptionLeg; +import com.konfigthis.client.model.OptionsGetOptionStrategyRequest; +import com.konfigthis.client.model.OptionsPlaceOptionStrategyRequest; +import com.konfigthis.client.model.OptionsPosition; +import com.konfigthis.client.model.OrderTypeStrict; +import com.konfigthis.client.model.StrategyOrderRecord; +import com.konfigthis.client.model.StrategyQuotes; +import com.konfigthis.client.model.TimeInForceStrict; +import java.util.UUID; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.ws.rs.core.GenericType; + +public class OptionsApiGenerated { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public OptionsApiGenerated() throws IllegalArgumentException { + this(Configuration.getDefaultApiClient()); + } + + public OptionsApiGenerated(ApiClient apiClient) throws IllegalArgumentException { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + private okhttp3.Call getOptionStrategyCall(String userId, String userSecret, UUID accountId, OptionsGetOptionStrategyRequest optionsGetOptionStrategyRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = optionsGetOptionStrategyRequest; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/optionStrategy" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (userId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userId", userId)); + } + + if (userSecret != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userSecret", userSecret)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getOptionStrategyValidateBeforeCall(String userId, String userSecret, UUID accountId, OptionsGetOptionStrategyRequest optionsGetOptionStrategyRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException("Missing the required parameter 'userId' when calling getOptionStrategy(Async)"); + } + + // verify the required parameter 'userSecret' is set + if (userSecret == null) { + throw new ApiException("Missing the required parameter 'userSecret' when calling getOptionStrategy(Async)"); + } + + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling getOptionStrategy(Async)"); + } + + // verify the required parameter 'optionsGetOptionStrategyRequest' is set + if (optionsGetOptionStrategyRequest == null) { + throw new ApiException("Missing the required parameter 'optionsGetOptionStrategyRequest' when calling getOptionStrategy(Async)"); + } + + return getOptionStrategyCall(userId, userSecret, accountId, optionsGetOptionStrategyRequest, _callback); + + } + + + private ApiResponse getOptionStrategyWithHttpInfo(String userId, String userSecret, UUID accountId, OptionsGetOptionStrategyRequest optionsGetOptionStrategyRequest) throws ApiException { + okhttp3.Call localVarCall = getOptionStrategyValidateBeforeCall(userId, userSecret, accountId, optionsGetOptionStrategyRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getOptionStrategyAsync(String userId, String userSecret, UUID accountId, OptionsGetOptionStrategyRequest optionsGetOptionStrategyRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getOptionStrategyValidateBeforeCall(userId, userSecret, accountId, optionsGetOptionStrategyRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class GetOptionStrategyRequestBuilderGenerated { + final UUID underlyingSymbolId; + final List legs; + final String strategyType; + final String userId; + final String userSecret; + final UUID accountId; + + public GetOptionStrategyRequestBuilderGenerated(UUID underlyingSymbolId, List legs, String strategyType, String userId, String userSecret, UUID accountId) { + this.underlyingSymbolId = underlyingSymbolId; + this.legs = legs; + this.strategyType = strategyType; + this.userId = userId; + this.userSecret = userSecret; + this.accountId = accountId; + } + + /** + * Build call for getOptionStrategy + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Order Quotes -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + OptionsGetOptionStrategyRequest optionsGetOptionStrategyRequest = buildBodyParams(); + return getOptionStrategyCall(userId, userSecret, accountId, optionsGetOptionStrategyRequest, _callback); + } + + private OptionsGetOptionStrategyRequest buildBodyParams() { + OptionsGetOptionStrategyRequest optionsGetOptionStrategyRequest = new OptionsGetOptionStrategyRequest(); + optionsGetOptionStrategyRequest.underlyingSymbolId(this.underlyingSymbolId); + optionsGetOptionStrategyRequest.legs(this.legs); + if (this.strategyType != null) + optionsGetOptionStrategyRequest.strategyType(OptionsGetOptionStrategyRequest.StrategyTypeEnum.fromValue(this.strategyType)); + return optionsGetOptionStrategyRequest; + } + + /** + * Execute getOptionStrategy request + * @return StrategyQuotes + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Order Quotes -
+ */ + public StrategyQuotes execute() throws ApiException { + OptionsGetOptionStrategyRequest optionsGetOptionStrategyRequest = buildBodyParams(); + ApiResponse localVarResp = getOptionStrategyWithHttpInfo(userId, userSecret, accountId, optionsGetOptionStrategyRequest); + return localVarResp.getResponseBody(); + } + + /** + * Execute getOptionStrategy request with HTTP info returned + * @return ApiResponse<StrategyQuotes> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Order Quotes -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + OptionsGetOptionStrategyRequest optionsGetOptionStrategyRequest = buildBodyParams(); + return getOptionStrategyWithHttpInfo(userId, userSecret, accountId, optionsGetOptionStrategyRequest); + } + + /** + * Execute getOptionStrategy request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Order Quotes -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + OptionsGetOptionStrategyRequest optionsGetOptionStrategyRequest = buildBodyParams(); + return getOptionStrategyAsync(userId, userSecret, accountId, optionsGetOptionStrategyRequest, _callback); + } + } + + /** + * Create options strategy + * Creates an option strategy object that will be used to place an option strategy order. + * @param userId (required) + * @param userSecret (required) + * @param accountId The ID of the account to create the option strategy object in. (required) + * @param optionsGetOptionStrategyRequest (required) + * @return GetOptionStrategyRequestBuilder + * @http.response.details + + + +
Status Code Description Response Headers
200 Order Quotes -
+ */ + public OptionsApi.GetOptionStrategyRequestBuilder getOptionStrategy(UUID underlyingSymbolId, List legs, String strategyType, String userId, String userSecret, UUID accountId) throws IllegalArgumentException { + if (underlyingSymbolId == null) throw new IllegalArgumentException("\"underlyingSymbolId\" is required but got null"); + + + if (legs == null) throw new IllegalArgumentException("\"legs\" is required but got null"); + if (strategyType == null) throw new IllegalArgumentException("\"strategyType\" is required but got null"); + + + if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null"); + + + if (userSecret == null) throw new IllegalArgumentException("\"userSecret\" is required but got null"); + + + if (accountId == null) throw new IllegalArgumentException("\"accountId\" is required but got null"); + + + return ((OptionsApi) this).new GetOptionStrategyRequestBuilder(underlyingSymbolId, legs, strategyType, userId, userSecret, accountId); + } + private okhttp3.Call getOptionsChainCall(String userId, String userSecret, UUID accountId, UUID symbol, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/optionsChain" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (userId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userId", userId)); + } + + if (userSecret != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userSecret", userSecret)); + } + + if (symbol != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("symbol", symbol)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getOptionsChainValidateBeforeCall(String userId, String userSecret, UUID accountId, UUID symbol, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException("Missing the required parameter 'userId' when calling getOptionsChain(Async)"); + } + + // verify the required parameter 'userSecret' is set + if (userSecret == null) { + throw new ApiException("Missing the required parameter 'userSecret' when calling getOptionsChain(Async)"); + } + + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling getOptionsChain(Async)"); + } + + // verify the required parameter 'symbol' is set + if (symbol == null) { + throw new ApiException("Missing the required parameter 'symbol' when calling getOptionsChain(Async)"); + } + + return getOptionsChainCall(userId, userSecret, accountId, symbol, _callback); + + } + + + private ApiResponse> getOptionsChainWithHttpInfo(String userId, String userSecret, UUID accountId, UUID symbol) throws ApiException { + okhttp3.Call localVarCall = getOptionsChainValidateBeforeCall(userId, userSecret, accountId, symbol, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getOptionsChainAsync(String userId, String userSecret, UUID accountId, UUID symbol, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getOptionsChainValidateBeforeCall(userId, userSecret, accountId, symbol, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class GetOptionsChainRequestBuilderGenerated { + final String userId; + final String userSecret; + final UUID accountId; + final UUID symbol; + + public GetOptionsChainRequestBuilderGenerated(String userId, String userSecret, UUID accountId, UUID symbol) { + this.userId = userId; + this.userSecret = userSecret; + this.accountId = accountId; + this.symbol = symbol; + } + + /** + * Build call for getOptionsChain + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 List of all Options available for the brokerage symbol -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getOptionsChainCall(userId, userSecret, accountId, symbol, _callback); + } + + + /** + * Execute getOptionsChain request + * @return List<OptionChainInner> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 List of all Options available for the brokerage symbol -
+ */ + public List execute() throws ApiException { + ApiResponse> localVarResp = getOptionsChainWithHttpInfo(userId, userSecret, accountId, symbol); + return localVarResp.getResponseBody(); + } + + /** + * Execute getOptionsChain request with HTTP info returned + * @return ApiResponse<List<OptionChainInner>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 List of all Options available for the brokerage symbol -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + return getOptionsChainWithHttpInfo(userId, userSecret, accountId, symbol); + } + + /** + * Execute getOptionsChain request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 List of all Options available for the brokerage symbol -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return getOptionsChainAsync(userId, userSecret, accountId, symbol, _callback); + } + } + + /** + * Get the options chain for a symbol + * Returns the option chain for the specified symbol in the specified account. + * @param userId (required) + * @param userSecret (required) + * @param accountId The ID of the account to get the options chain from. (required) + * @param symbol Universal symbol ID if symbol (required) + * @return GetOptionsChainRequestBuilder + * @http.response.details + + + +
Status Code Description Response Headers
200 List of all Options available for the brokerage symbol -
+ */ + public OptionsApi.GetOptionsChainRequestBuilder getOptionsChain(String userId, String userSecret, UUID accountId, UUID symbol) throws IllegalArgumentException { + if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null"); + + + if (userSecret == null) throw new IllegalArgumentException("\"userSecret\" is required but got null"); + + + if (accountId == null) throw new IllegalArgumentException("\"accountId\" is required but got null"); + + + if (symbol == null) throw new IllegalArgumentException("\"symbol\" is required but got null"); + + + return ((OptionsApi) this).new GetOptionsChainRequestBuilder(userId, userSecret, accountId, symbol); + } + private okhttp3.Call getOptionsStrategyQuoteCall(String userId, String userSecret, UUID accountId, UUID optionStrategyId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/optionStrategy/{optionStrategyId}" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())) + .replace("{" + "optionStrategyId" + "}", localVarApiClient.escapeString(optionStrategyId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (userId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userId", userId)); + } + + if (userSecret != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userSecret", userSecret)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getOptionsStrategyQuoteValidateBeforeCall(String userId, String userSecret, UUID accountId, UUID optionStrategyId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException("Missing the required parameter 'userId' when calling getOptionsStrategyQuote(Async)"); + } + + // verify the required parameter 'userSecret' is set + if (userSecret == null) { + throw new ApiException("Missing the required parameter 'userSecret' when calling getOptionsStrategyQuote(Async)"); + } + + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling getOptionsStrategyQuote(Async)"); + } + + // verify the required parameter 'optionStrategyId' is set + if (optionStrategyId == null) { + throw new ApiException("Missing the required parameter 'optionStrategyId' when calling getOptionsStrategyQuote(Async)"); + } + + return getOptionsStrategyQuoteCall(userId, userSecret, accountId, optionStrategyId, _callback); + + } + + + private ApiResponse getOptionsStrategyQuoteWithHttpInfo(String userId, String userSecret, UUID accountId, UUID optionStrategyId) throws ApiException { + okhttp3.Call localVarCall = getOptionsStrategyQuoteValidateBeforeCall(userId, userSecret, accountId, optionStrategyId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getOptionsStrategyQuoteAsync(String userId, String userSecret, UUID accountId, UUID optionStrategyId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getOptionsStrategyQuoteValidateBeforeCall(userId, userSecret, accountId, optionStrategyId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class GetOptionsStrategyQuoteRequestBuilderGenerated { + final String userId; + final String userSecret; + final UUID accountId; + final UUID optionStrategyId; + + public GetOptionsStrategyQuoteRequestBuilderGenerated(String userId, String userSecret, UUID accountId, UUID optionStrategyId) { + this.userId = userId; + this.userSecret = userSecret; + this.accountId = accountId; + this.optionStrategyId = optionStrategyId; + } + + /** + * Build call for getOptionsStrategyQuote + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Order Quotes -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getOptionsStrategyQuoteCall(userId, userSecret, accountId, optionStrategyId, _callback); + } + + + /** + * Execute getOptionsStrategyQuote request + * @return StrategyQuotes + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Order Quotes -
+ */ + public StrategyQuotes execute() throws ApiException { + ApiResponse localVarResp = getOptionsStrategyQuoteWithHttpInfo(userId, userSecret, accountId, optionStrategyId); + return localVarResp.getResponseBody(); + } + + /** + * Execute getOptionsStrategyQuote request with HTTP info returned + * @return ApiResponse<StrategyQuotes> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Order Quotes -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getOptionsStrategyQuoteWithHttpInfo(userId, userSecret, accountId, optionStrategyId); + } + + /** + * Execute getOptionsStrategyQuote request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Order Quotes -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getOptionsStrategyQuoteAsync(userId, userSecret, accountId, optionStrategyId, _callback); + } + } + + /** + * Get options strategy quotes + * Returns a Strategy Quotes object which has latest market data of the specified option strategy. + * @param userId (required) + * @param userSecret (required) + * @param accountId The ID of the account the strategy will be placed in. (required) + * @param optionStrategyId Option strategy id obtained from response when creating option strategy object (required) + * @return GetOptionsStrategyQuoteRequestBuilder + * @http.response.details + + + +
Status Code Description Response Headers
200 Order Quotes -
+ */ + public OptionsApi.GetOptionsStrategyQuoteRequestBuilder getOptionsStrategyQuote(String userId, String userSecret, UUID accountId, UUID optionStrategyId) throws IllegalArgumentException { + if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null"); + + + if (userSecret == null) throw new IllegalArgumentException("\"userSecret\" is required but got null"); + + + if (accountId == null) throw new IllegalArgumentException("\"accountId\" is required but got null"); + + + if (optionStrategyId == null) throw new IllegalArgumentException("\"optionStrategyId\" is required but got null"); + + + return ((OptionsApi) this).new GetOptionsStrategyQuoteRequestBuilder(userId, userSecret, accountId, optionStrategyId); + } + private okhttp3.Call listOptionHoldingsCall(String userId, String userSecret, UUID accountId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/options" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (userId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userId", userId)); + } + + if (userSecret != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userSecret", userSecret)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listOptionHoldingsValidateBeforeCall(String userId, String userSecret, UUID accountId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException("Missing the required parameter 'userId' when calling listOptionHoldings(Async)"); + } + + // verify the required parameter 'userSecret' is set + if (userSecret == null) { + throw new ApiException("Missing the required parameter 'userSecret' when calling listOptionHoldings(Async)"); + } + + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling listOptionHoldings(Async)"); + } + + return listOptionHoldingsCall(userId, userSecret, accountId, _callback); + + } + + + private ApiResponse> listOptionHoldingsWithHttpInfo(String userId, String userSecret, UUID accountId) throws ApiException { + okhttp3.Call localVarCall = listOptionHoldingsValidateBeforeCall(userId, userSecret, accountId, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call listOptionHoldingsAsync(String userId, String userSecret, UUID accountId, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = listOptionHoldingsValidateBeforeCall(userId, userSecret, accountId, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class ListOptionHoldingsRequestBuilderGenerated { + final String userId; + final String userSecret; + final UUID accountId; + + public ListOptionHoldingsRequestBuilderGenerated(String userId, String userSecret, UUID accountId) { + this.userId = userId; + this.userSecret = userSecret; + this.accountId = accountId; + } + + /** + * Build call for listOptionHoldings + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 The option holdings in the account -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return listOptionHoldingsCall(userId, userSecret, accountId, _callback); + } + + + /** + * Execute listOptionHoldings request + * @return List<OptionsPosition> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 The option holdings in the account -
+ */ + public List execute() throws ApiException { + ApiResponse> localVarResp = listOptionHoldingsWithHttpInfo(userId, userSecret, accountId); + return localVarResp.getResponseBody(); + } + + /** + * Execute listOptionHoldings request with HTTP info returned + * @return ApiResponse<List<OptionsPosition>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 The option holdings in the account -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + return listOptionHoldingsWithHttpInfo(userId, userSecret, accountId); + } + + /** + * Execute listOptionHoldings request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 The option holdings in the account -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return listOptionHoldingsAsync(userId, userSecret, accountId, _callback); + } + } + + /** + * Get account option holdings + * Returns a list of Options Positions. + * @param userId (required) + * @param userSecret (required) + * @param accountId The ID of the account to fetch options holdings for. (required) + * @return ListOptionHoldingsRequestBuilder + * @http.response.details + + + +
Status Code Description Response Headers
200 The option holdings in the account -
+ */ + public OptionsApi.ListOptionHoldingsRequestBuilder listOptionHoldings(String userId, String userSecret, UUID accountId) throws IllegalArgumentException { + if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null"); + + + if (userSecret == null) throw new IllegalArgumentException("\"userSecret\" is required but got null"); + + + if (accountId == null) throw new IllegalArgumentException("\"accountId\" is required but got null"); + + + return ((OptionsApi) this).new ListOptionHoldingsRequestBuilder(userId, userSecret, accountId); + } + private okhttp3.Call placeOptionStrategyCall(String userId, String userSecret, UUID accountId, UUID optionStrategyId, OptionsPlaceOptionStrategyRequest optionsPlaceOptionStrategyRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = optionsPlaceOptionStrategyRequest; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/optionStrategy/{optionStrategyId}/execute" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())) + .replace("{" + "optionStrategyId" + "}", localVarApiClient.escapeString(optionStrategyId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (userId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userId", userId)); + } + + if (userSecret != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userSecret", userSecret)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call placeOptionStrategyValidateBeforeCall(String userId, String userSecret, UUID accountId, UUID optionStrategyId, OptionsPlaceOptionStrategyRequest optionsPlaceOptionStrategyRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException("Missing the required parameter 'userId' when calling placeOptionStrategy(Async)"); + } + + // verify the required parameter 'userSecret' is set + if (userSecret == null) { + throw new ApiException("Missing the required parameter 'userSecret' when calling placeOptionStrategy(Async)"); + } + + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling placeOptionStrategy(Async)"); + } + + // verify the required parameter 'optionStrategyId' is set + if (optionStrategyId == null) { + throw new ApiException("Missing the required parameter 'optionStrategyId' when calling placeOptionStrategy(Async)"); + } + + // verify the required parameter 'optionsPlaceOptionStrategyRequest' is set + if (optionsPlaceOptionStrategyRequest == null) { + throw new ApiException("Missing the required parameter 'optionsPlaceOptionStrategyRequest' when calling placeOptionStrategy(Async)"); + } + + return placeOptionStrategyCall(userId, userSecret, accountId, optionStrategyId, optionsPlaceOptionStrategyRequest, _callback); + + } + + + private ApiResponse placeOptionStrategyWithHttpInfo(String userId, String userSecret, UUID accountId, UUID optionStrategyId, OptionsPlaceOptionStrategyRequest optionsPlaceOptionStrategyRequest) throws ApiException { + okhttp3.Call localVarCall = placeOptionStrategyValidateBeforeCall(userId, userSecret, accountId, optionStrategyId, optionsPlaceOptionStrategyRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call placeOptionStrategyAsync(String userId, String userSecret, UUID accountId, UUID optionStrategyId, OptionsPlaceOptionStrategyRequest optionsPlaceOptionStrategyRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = placeOptionStrategyValidateBeforeCall(userId, userSecret, accountId, optionStrategyId, optionsPlaceOptionStrategyRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class PlaceOptionStrategyRequestBuilderGenerated { + final OrderTypeStrict orderType; + final TimeInForceStrict timeInForce; + final String userId; + final String userSecret; + final UUID accountId; + final UUID optionStrategyId; + Double price; + + public PlaceOptionStrategyRequestBuilderGenerated(OrderTypeStrict orderType, TimeInForceStrict timeInForce, String userId, String userSecret, UUID accountId, UUID optionStrategyId) { + this.orderType = orderType; + this.timeInForce = timeInForce; + this.userId = userId; + this.userSecret = userSecret; + this.accountId = accountId; + this.optionStrategyId = optionStrategyId; + } + + /** + * Set price + * @param price Trade Price if limit or stop limit order (optional) + * @return OptionsApi.PlaceOptionStrategyRequestBuilder + */ + public OptionsApi.PlaceOptionStrategyRequestBuilder price(Double price) { + this.price = price; + return (OptionsApi.PlaceOptionStrategyRequestBuilder) this; + } + + + /** + * Set price + * @param price Trade Price if limit or stop limit order (optional) + * @return OptionsApi.PlaceOptionStrategyRequestBuilder + */ + public OptionsApi.PlaceOptionStrategyRequestBuilder price(Integer price) { + this.price = price.doubleValue(); + return (OptionsApi.PlaceOptionStrategyRequestBuilder) this; + } + + /** + * Build call for placeOptionStrategy + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Status of strategy order placed -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + OptionsPlaceOptionStrategyRequest optionsPlaceOptionStrategyRequest = buildBodyParams(); + return placeOptionStrategyCall(userId, userSecret, accountId, optionStrategyId, optionsPlaceOptionStrategyRequest, _callback); + } + + private OptionsPlaceOptionStrategyRequest buildBodyParams() { + OptionsPlaceOptionStrategyRequest optionsPlaceOptionStrategyRequest = new OptionsPlaceOptionStrategyRequest(); + optionsPlaceOptionStrategyRequest.orderType(this.orderType); + optionsPlaceOptionStrategyRequest.timeInForce(this.timeInForce); + optionsPlaceOptionStrategyRequest.price(this.price); + return optionsPlaceOptionStrategyRequest; + } + + /** + * Execute placeOptionStrategy request + * @return StrategyOrderRecord + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Status of strategy order placed -
+ */ + public StrategyOrderRecord execute() throws ApiException { + OptionsPlaceOptionStrategyRequest optionsPlaceOptionStrategyRequest = buildBodyParams(); + ApiResponse localVarResp = placeOptionStrategyWithHttpInfo(userId, userSecret, accountId, optionStrategyId, optionsPlaceOptionStrategyRequest); + return localVarResp.getResponseBody(); + } + + /** + * Execute placeOptionStrategy request with HTTP info returned + * @return ApiResponse<StrategyOrderRecord> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Status of strategy order placed -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + OptionsPlaceOptionStrategyRequest optionsPlaceOptionStrategyRequest = buildBodyParams(); + return placeOptionStrategyWithHttpInfo(userId, userSecret, accountId, optionStrategyId, optionsPlaceOptionStrategyRequest); + } + + /** + * Execute placeOptionStrategy request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Status of strategy order placed -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + OptionsPlaceOptionStrategyRequest optionsPlaceOptionStrategyRequest = buildBodyParams(); + return placeOptionStrategyAsync(userId, userSecret, accountId, optionStrategyId, optionsPlaceOptionStrategyRequest, _callback); + } + } + + /** + * Place an option strategy order + * Places the option strategy order and returns the order record received from the brokerage. + * @param userId (required) + * @param userSecret (required) + * @param accountId The ID of the account to execute the strategy in. (required) + * @param optionStrategyId Option strategy id obtained from response when creating option strategy object (required) + * @param optionsPlaceOptionStrategyRequest (required) + * @return PlaceOptionStrategyRequestBuilder + * @http.response.details + + + +
Status Code Description Response Headers
200 Status of strategy order placed -
+ */ + public OptionsApi.PlaceOptionStrategyRequestBuilder placeOptionStrategy(OrderTypeStrict orderType, TimeInForceStrict timeInForce, String userId, String userSecret, UUID accountId, UUID optionStrategyId) throws IllegalArgumentException { + if (orderType == null) throw new IllegalArgumentException("\"orderType\" is required but got null"); + if (timeInForce == null) throw new IllegalArgumentException("\"timeInForce\" is required but got null"); + if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null"); + + + if (userSecret == null) throw new IllegalArgumentException("\"userSecret\" is required but got null"); + + + if (accountId == null) throw new IllegalArgumentException("\"accountId\" is required but got null"); + + + if (optionStrategyId == null) throw new IllegalArgumentException("\"optionStrategyId\" is required but got null"); + + + return ((OptionsApi) this).new PlaceOptionStrategyRequestBuilder(orderType, timeInForce, userId, userSecret, accountId, optionStrategyId); + } +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/ReferenceDataApi.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/ReferenceDataApi.java new file mode 100644 index 0000000000..701a2046c5 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/ReferenceDataApi.java @@ -0,0 +1,79 @@ +package com.konfigthis.client.api; + +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.model.Brokerage; +import com.konfigthis.client.model.BrokerageAuthorizationTypeReadOnly; +import com.konfigthis.client.model.Currency; +import com.konfigthis.client.model.Exchange; +import com.konfigthis.client.model.ExchangeRatePairs; +import com.konfigthis.client.model.PartnerData; +import com.konfigthis.client.model.SecurityType; +import com.konfigthis.client.model.SymbolQuery; +import java.util.UUID; +import com.konfigthis.client.model.UniversalSymbol; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ReferenceDataApi extends ReferenceDataApiGenerated { + + public ReferenceDataApi(ApiClient apiClient) throws IllegalArgumentException { + super(apiClient); + } + public class GetCurrencyExchangeRatePairRequestBuilder extends GetCurrencyExchangeRatePairRequestBuilderGenerated { + public GetCurrencyExchangeRatePairRequestBuilder(String currencyPair) { + super(currencyPair); + } + } + public class GetPartnerInfoRequestBuilder extends GetPartnerInfoRequestBuilderGenerated { + public GetPartnerInfoRequestBuilder() { + super(); + } + } + public class GetSecurityTypesRequestBuilder extends GetSecurityTypesRequestBuilderGenerated { + public GetSecurityTypesRequestBuilder() { + super(); + } + } + public class GetStockExchangesRequestBuilder extends GetStockExchangesRequestBuilderGenerated { + public GetStockExchangesRequestBuilder() { + super(); + } + } + public class GetSymbolsRequestBuilder extends GetSymbolsRequestBuilderGenerated { + public GetSymbolsRequestBuilder() { + super(); + } + } + public class GetSymbolsByTickerRequestBuilder extends GetSymbolsByTickerRequestBuilderGenerated { + public GetSymbolsByTickerRequestBuilder(String query) { + super(query); + } + } + public class ListAllBrokerageAuthorizationTypeRequestBuilder extends ListAllBrokerageAuthorizationTypeRequestBuilderGenerated { + public ListAllBrokerageAuthorizationTypeRequestBuilder() { + super(); + } + } + public class ListAllBrokeragesRequestBuilder extends ListAllBrokeragesRequestBuilderGenerated { + public ListAllBrokeragesRequestBuilder() { + super(); + } + } + public class ListAllCurrenciesRequestBuilder extends ListAllCurrenciesRequestBuilderGenerated { + public ListAllCurrenciesRequestBuilder() { + super(); + } + } + public class ListAllCurrenciesRatesRequestBuilder extends ListAllCurrenciesRatesRequestBuilderGenerated { + public ListAllCurrenciesRatesRequestBuilder() { + super(); + } + } + public class SymbolSearchUserAccountRequestBuilder extends SymbolSearchUserAccountRequestBuilderGenerated { + public SymbolSearchUserAccountRequestBuilder(String userId, String userSecret, UUID accountId) { + super(userId, userSecret, accountId); + } + } +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/ReferenceDataApiGenerated.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/ReferenceDataApiGenerated.java new file mode 100644 index 0000000000..cf28c329e6 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/ReferenceDataApiGenerated.java @@ -0,0 +1,1836 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.api; + +import com.konfigthis.client.ApiCallback; +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.Pair; +import com.konfigthis.client.ProgressRequestBody; +import com.konfigthis.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.konfigthis.client.model.Brokerage; +import com.konfigthis.client.model.BrokerageAuthorizationTypeReadOnly; +import com.konfigthis.client.model.Currency; +import com.konfigthis.client.model.Exchange; +import com.konfigthis.client.model.ExchangeRatePairs; +import com.konfigthis.client.model.PartnerData; +import com.konfigthis.client.model.SecurityType; +import com.konfigthis.client.model.SymbolQuery; +import java.util.UUID; +import com.konfigthis.client.model.UniversalSymbol; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.ws.rs.core.GenericType; + +public class ReferenceDataApiGenerated { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public ReferenceDataApiGenerated() throws IllegalArgumentException { + this(Configuration.getDefaultApiClient()); + } + + public ReferenceDataApiGenerated(ApiClient apiClient) throws IllegalArgumentException { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + private okhttp3.Call getCurrencyExchangeRatePairCall(String currencyPair, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/currencies/rates/{currencyPair}" + .replace("{" + "currencyPair" + "}", localVarApiClient.escapeString(currencyPair.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getCurrencyExchangeRatePairValidateBeforeCall(String currencyPair, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'currencyPair' is set + if (currencyPair == null) { + throw new ApiException("Missing the required parameter 'currencyPair' when calling getCurrencyExchangeRatePair(Async)"); + } + + return getCurrencyExchangeRatePairCall(currencyPair, _callback); + + } + + + private ApiResponse getCurrencyExchangeRatePairWithHttpInfo(String currencyPair) throws ApiException { + okhttp3.Call localVarCall = getCurrencyExchangeRatePairValidateBeforeCall(currencyPair, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getCurrencyExchangeRatePairAsync(String currencyPair, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getCurrencyExchangeRatePairValidateBeforeCall(currencyPair, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class GetCurrencyExchangeRatePairRequestBuilderGenerated { + final String currencyPair; + + public GetCurrencyExchangeRatePairRequestBuilderGenerated(String currencyPair) { + this.currencyPair = currencyPair; + } + + /** + * Build call for getCurrencyExchangeRatePair + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 A list of all exchange rates pairs for supported currencies -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getCurrencyExchangeRatePairCall(currencyPair, _callback); + } + + + /** + * Execute getCurrencyExchangeRatePair request + * @return ExchangeRatePairs + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 A list of all exchange rates pairs for supported currencies -
+ */ + public ExchangeRatePairs execute() throws ApiException { + ApiResponse localVarResp = getCurrencyExchangeRatePairWithHttpInfo(currencyPair); + return localVarResp.getResponseBody(); + } + + /** + * Execute getCurrencyExchangeRatePair request with HTTP info returned + * @return ApiResponse<ExchangeRatePairs> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 A list of all exchange rates pairs for supported currencies -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getCurrencyExchangeRatePairWithHttpInfo(currencyPair); + } + + /** + * Execute getCurrencyExchangeRatePair request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 A list of all exchange rates pairs for supported currencies -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getCurrencyExchangeRatePairAsync(currencyPair, _callback); + } + } + + /** + * Get exchange rate of a currency pair + * Returns an Exchange Rate Pair object for the specified Currency Pair. + * @param currencyPair A currency pair based on currency code for example, {CAD-USD} (required) + * @return GetCurrencyExchangeRatePairRequestBuilder + * @http.response.details + + + +
Status Code Description Response Headers
200 A list of all exchange rates pairs for supported currencies -
+ */ + public ReferenceDataApi.GetCurrencyExchangeRatePairRequestBuilder getCurrencyExchangeRatePair(String currencyPair) throws IllegalArgumentException { + if (currencyPair == null) throw new IllegalArgumentException("\"currencyPair\" is required but got null"); + + + return ((ReferenceDataApi) this).new GetCurrencyExchangeRatePairRequestBuilder(currencyPair); + } + private okhttp3.Call getPartnerInfoCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/snapTrade/partners"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPartnerInfoValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getPartnerInfoCall(_callback); + + } + + + private ApiResponse getPartnerInfoWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getPartnerInfoValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getPartnerInfoAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPartnerInfoValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class GetPartnerInfoRequestBuilderGenerated { + + public GetPartnerInfoRequestBuilderGenerated() { + } + + /** + * Build call for getPartnerInfo + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successfully obtained encrypted JWT data. See description on how to object JWT token -
500 Unexpected Error -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getPartnerInfoCall(_callback); + } + + + /** + * Execute getPartnerInfo request + * @return PartnerData + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successfully obtained encrypted JWT data. See description on how to object JWT token -
500 Unexpected Error -
+ */ + public PartnerData execute() throws ApiException { + ApiResponse localVarResp = getPartnerInfoWithHttpInfo(); + return localVarResp.getResponseBody(); + } + + /** + * Execute getPartnerInfo request with HTTP info returned + * @return ApiResponse<PartnerData> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successfully obtained encrypted JWT data. See description on how to object JWT token -
500 Unexpected Error -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getPartnerInfoWithHttpInfo(); + } + + /** + * Execute getPartnerInfo request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successfully obtained encrypted JWT data. See description on how to object JWT token -
500 Unexpected Error -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getPartnerInfoAsync(_callback); + } + } + + /** + * Get metadata related to Snaptrade partner + * Returns useful data related to the specified ClientID, including allowed brokerages and data access. + * @return GetPartnerInfoRequestBuilder + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successfully obtained encrypted JWT data. See description on how to object JWT token -
500 Unexpected Error -
+ */ + public ReferenceDataApi.GetPartnerInfoRequestBuilder getPartnerInfo() throws IllegalArgumentException { + return ((ReferenceDataApi) this).new GetPartnerInfoRequestBuilder(); + } + private okhttp3.Call getSecurityTypesCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/securityTypes"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getSecurityTypesValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getSecurityTypesCall(_callback); + + } + + + private ApiResponse> getSecurityTypesWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getSecurityTypesValidateBeforeCall(null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getSecurityTypesAsync(final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getSecurityTypesValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class GetSecurityTypesRequestBuilderGenerated { + + public GetSecurityTypesRequestBuilderGenerated() { + } + + /** + * Build call for getSecurityTypes + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of all defined Security Type objects. -
0 Unexpected error. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getSecurityTypesCall(_callback); + } + + + /** + * Execute getSecurityTypes request + * @return List<SecurityType> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of all defined Security Type objects. -
0 Unexpected error. -
+ */ + public List execute() throws ApiException { + ApiResponse> localVarResp = getSecurityTypesWithHttpInfo(); + return localVarResp.getResponseBody(); + } + + /** + * Execute getSecurityTypes request with HTTP info returned + * @return ApiResponse<List<SecurityType>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of all defined Security Type objects. -
0 Unexpected error. -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + return getSecurityTypesWithHttpInfo(); + } + + /** + * Execute getSecurityTypes request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of all defined Security Type objects. -
0 Unexpected error. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return getSecurityTypesAsync(_callback); + } + } + + /** + * List of all security types + * List security types available on SnapTrade. + * @return GetSecurityTypesRequestBuilder + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of all defined Security Type objects. -
0 Unexpected error. -
+ */ + public ReferenceDataApi.GetSecurityTypesRequestBuilder getSecurityTypes() throws IllegalArgumentException { + return ((ReferenceDataApi) this).new GetSecurityTypesRequestBuilder(); + } + private okhttp3.Call getStockExchangesCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/exchanges"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getStockExchangesValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getStockExchangesCall(_callback); + + } + + + private ApiResponse> getStockExchangesWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getStockExchangesValidateBeforeCall(null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getStockExchangesAsync(final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getStockExchangesValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class GetStockExchangesRequestBuilderGenerated { + + public GetStockExchangesRequestBuilderGenerated() { + } + + /** + * Build call for getStockExchanges + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 A list of all supported stock exchanges -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getStockExchangesCall(_callback); + } + + + /** + * Execute getStockExchanges request + * @return List<Exchange> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 A list of all supported stock exchanges -
+ */ + public List execute() throws ApiException { + ApiResponse> localVarResp = getStockExchangesWithHttpInfo(); + return localVarResp.getResponseBody(); + } + + /** + * Execute getStockExchanges request with HTTP info returned + * @return ApiResponse<List<Exchange>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 A list of all supported stock exchanges -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + return getStockExchangesWithHttpInfo(); + } + + /** + * Execute getStockExchanges request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 A list of all supported stock exchanges -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return getStockExchangesAsync(_callback); + } + } + + /** + * Get exchanges + * Returns a list of all supported Exchanges. + * @return GetStockExchangesRequestBuilder + * @http.response.details + + + +
Status Code Description Response Headers
200 A list of all supported stock exchanges -
+ */ + public ReferenceDataApi.GetStockExchangesRequestBuilder getStockExchanges() throws IllegalArgumentException { + return ((ReferenceDataApi) this).new GetStockExchangesRequestBuilder(); + } + private okhttp3.Call getSymbolsCall(SymbolQuery symbolQuery, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = symbolQuery; + + // create path and map variables + String localVarPath = "/symbols"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getSymbolsValidateBeforeCall(SymbolQuery symbolQuery, final ApiCallback _callback) throws ApiException { + return getSymbolsCall(symbolQuery, _callback); + + } + + + private ApiResponse> getSymbolsWithHttpInfo(SymbolQuery symbolQuery) throws ApiException { + okhttp3.Call localVarCall = getSymbolsValidateBeforeCall(symbolQuery, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getSymbolsAsync(SymbolQuery symbolQuery, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getSymbolsValidateBeforeCall(symbolQuery, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class GetSymbolsRequestBuilderGenerated { + String substring; + + public GetSymbolsRequestBuilderGenerated() { + } + + /** + * Set substring + * @param substring (optional) + * @return ReferenceDataApi.GetSymbolsRequestBuilder + */ + public ReferenceDataApi.GetSymbolsRequestBuilder substring(String substring) { + this.substring = substring; + return (ReferenceDataApi.GetSymbolsRequestBuilder) this; + } + + /** + * Build call for getSymbols + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of UniversalSymbol objects which match the specified substring -
0 Unexpected error. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + SymbolQuery symbolQuery = buildBodyParams(); + return getSymbolsCall(symbolQuery, _callback); + } + + private SymbolQuery buildBodyParams() { + SymbolQuery symbolQuery = new SymbolQuery(); + symbolQuery.substring(this.substring); + return symbolQuery; + } + + /** + * Execute getSymbols request + * @return List<UniversalSymbol> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of UniversalSymbol objects which match the specified substring -
0 Unexpected error. -
+ */ + public List execute() throws ApiException { + SymbolQuery symbolQuery = buildBodyParams(); + ApiResponse> localVarResp = getSymbolsWithHttpInfo(symbolQuery); + return localVarResp.getResponseBody(); + } + + /** + * Execute getSymbols request with HTTP info returned + * @return ApiResponse<List<UniversalSymbol>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of UniversalSymbol objects which match the specified substring -
0 Unexpected error. -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + SymbolQuery symbolQuery = buildBodyParams(); + return getSymbolsWithHttpInfo(symbolQuery); + } + + /** + * Execute getSymbols request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of UniversalSymbol objects which match the specified substring -
0 Unexpected error. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + SymbolQuery symbolQuery = buildBodyParams(); + return getSymbolsAsync(symbolQuery, _callback); + } + } + + /** + * Search for symbols + * Returns a list of Universal Symbol objects that match a defined string. Matches on ticker or name. + * @return GetSymbolsRequestBuilder + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of UniversalSymbol objects which match the specified substring -
0 Unexpected error. -
+ */ + public ReferenceDataApi.GetSymbolsRequestBuilder getSymbols() throws IllegalArgumentException { + return ((ReferenceDataApi) this).new GetSymbolsRequestBuilder(); + } + private okhttp3.Call getSymbolsByTickerCall(String query, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/symbols/{query}" + .replace("{" + "query" + "}", localVarApiClient.escapeString(query.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getSymbolsByTickerValidateBeforeCall(String query, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'query' is set + if (query == null) { + throw new ApiException("Missing the required parameter 'query' when calling getSymbolsByTicker(Async)"); + } + + return getSymbolsByTickerCall(query, _callback); + + } + + + private ApiResponse getSymbolsByTickerWithHttpInfo(String query) throws ApiException { + okhttp3.Call localVarCall = getSymbolsByTickerValidateBeforeCall(query, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getSymbolsByTickerAsync(String query, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getSymbolsByTickerValidateBeforeCall(query, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class GetSymbolsByTickerRequestBuilderGenerated { + final String query; + + public GetSymbolsByTickerRequestBuilderGenerated(String query) { + this.query = query; + } + + /** + * Build call for getSymbolsByTicker + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Successfully gets a symbol -
404 No symbol with the specified ticker found. -
0 Unexpected error -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getSymbolsByTickerCall(query, _callback); + } + + + /** + * Execute getSymbolsByTicker request + * @return UniversalSymbol + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Successfully gets a symbol -
404 No symbol with the specified ticker found. -
0 Unexpected error -
+ */ + public UniversalSymbol execute() throws ApiException { + ApiResponse localVarResp = getSymbolsByTickerWithHttpInfo(query); + return localVarResp.getResponseBody(); + } + + /** + * Execute getSymbolsByTicker request with HTTP info returned + * @return ApiResponse<UniversalSymbol> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Successfully gets a symbol -
404 No symbol with the specified ticker found. -
0 Unexpected error -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getSymbolsByTickerWithHttpInfo(query); + } + + /** + * Execute getSymbolsByTicker request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Successfully gets a symbol -
404 No symbol with the specified ticker found. -
0 Unexpected error -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getSymbolsByTickerAsync(query, _callback); + } + } + + /** + * Get details of a symbol + * Returns the Universal Symbol object specified by the ticker or the universal_symbol_id. + * @param query The ticker or universal_symbol_id of the UniversalSymbol to get. (required) + * @return GetSymbolsByTickerRequestBuilder + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Successfully gets a symbol -
404 No symbol with the specified ticker found. -
0 Unexpected error -
+ */ + public ReferenceDataApi.GetSymbolsByTickerRequestBuilder getSymbolsByTicker(String query) throws IllegalArgumentException { + if (query == null) throw new IllegalArgumentException("\"query\" is required but got null"); + + + return ((ReferenceDataApi) this).new GetSymbolsByTickerRequestBuilder(query); + } + private okhttp3.Call listAllBrokerageAuthorizationTypeCall(String brokerage, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/brokerageAuthorizationTypes"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (brokerage != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("brokerage", brokerage)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listAllBrokerageAuthorizationTypeValidateBeforeCall(String brokerage, final ApiCallback _callback) throws ApiException { + return listAllBrokerageAuthorizationTypeCall(brokerage, _callback); + + } + + + private ApiResponse> listAllBrokerageAuthorizationTypeWithHttpInfo(String brokerage) throws ApiException { + okhttp3.Call localVarCall = listAllBrokerageAuthorizationTypeValidateBeforeCall(brokerage, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call listAllBrokerageAuthorizationTypeAsync(String brokerage, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = listAllBrokerageAuthorizationTypeValidateBeforeCall(brokerage, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class ListAllBrokerageAuthorizationTypeRequestBuilderGenerated { + String brokerage; + + public ListAllBrokerageAuthorizationTypeRequestBuilderGenerated() { + } + + /** + * Set brokerage + * @param brokerage Comma separated value of brokerage slugs (optional) + * @return ReferenceDataApi.ListAllBrokerageAuthorizationTypeRequestBuilder + */ + public ReferenceDataApi.ListAllBrokerageAuthorizationTypeRequestBuilder brokerage(String brokerage) { + this.brokerage = brokerage; + return (ReferenceDataApi.ListAllBrokerageAuthorizationTypeRequestBuilder) this; + } + + /** + * Build call for listAllBrokerageAuthorizationType + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of all defined Brokerage Authorization Type objects. -
0 Unexpected error. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return listAllBrokerageAuthorizationTypeCall(brokerage, _callback); + } + + + /** + * Execute listAllBrokerageAuthorizationType request + * @return List<BrokerageAuthorizationTypeReadOnly> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of all defined Brokerage Authorization Type objects. -
0 Unexpected error. -
+ */ + public List execute() throws ApiException { + ApiResponse> localVarResp = listAllBrokerageAuthorizationTypeWithHttpInfo(brokerage); + return localVarResp.getResponseBody(); + } + + /** + * Execute listAllBrokerageAuthorizationType request with HTTP info returned + * @return ApiResponse<List<BrokerageAuthorizationTypeReadOnly>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of all defined Brokerage Authorization Type objects. -
0 Unexpected error. -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + return listAllBrokerageAuthorizationTypeWithHttpInfo(brokerage); + } + + /** + * Execute listAllBrokerageAuthorizationType request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of all defined Brokerage Authorization Type objects. -
0 Unexpected error. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return listAllBrokerageAuthorizationTypeAsync(brokerage, _callback); + } + } + + /** + * Get all brokerage authorization types + * Returns a list of all defined Brokerage authorization Type objects. + * @return ListAllBrokerageAuthorizationTypeRequestBuilder + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of all defined Brokerage Authorization Type objects. -
0 Unexpected error. -
+ */ + public ReferenceDataApi.ListAllBrokerageAuthorizationTypeRequestBuilder listAllBrokerageAuthorizationType() throws IllegalArgumentException { + return ((ReferenceDataApi) this).new ListAllBrokerageAuthorizationTypeRequestBuilder(); + } + private okhttp3.Call listAllBrokeragesCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/brokerages"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listAllBrokeragesValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return listAllBrokeragesCall(_callback); + + } + + + private ApiResponse> listAllBrokeragesWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = listAllBrokeragesValidateBeforeCall(null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call listAllBrokeragesAsync(final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = listAllBrokeragesValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class ListAllBrokeragesRequestBuilderGenerated { + + public ListAllBrokeragesRequestBuilderGenerated() { + } + + /** + * Build call for listAllBrokerages + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of all defined Brokerage objects. -
0 Unexpected error. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return listAllBrokeragesCall(_callback); + } + + + /** + * Execute listAllBrokerages request + * @return List<Brokerage> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of all defined Brokerage objects. -
0 Unexpected error. -
+ */ + public List execute() throws ApiException { + ApiResponse> localVarResp = listAllBrokeragesWithHttpInfo(); + return localVarResp.getResponseBody(); + } + + /** + * Execute listAllBrokerages request with HTTP info returned + * @return ApiResponse<List<Brokerage>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of all defined Brokerage objects. -
0 Unexpected error. -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + return listAllBrokeragesWithHttpInfo(); + } + + /** + * Execute listAllBrokerages request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of all defined Brokerage objects. -
0 Unexpected error. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return listAllBrokeragesAsync(_callback); + } + } + + /** + * Get brokerages + * Returns a list of all defined Brokerage objects. + * @return ListAllBrokeragesRequestBuilder + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of all defined Brokerage objects. -
0 Unexpected error. -
+ */ + public ReferenceDataApi.ListAllBrokeragesRequestBuilder listAllBrokerages() throws IllegalArgumentException { + return ((ReferenceDataApi) this).new ListAllBrokeragesRequestBuilder(); + } + private okhttp3.Call listAllCurrenciesCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/currencies"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listAllCurrenciesValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return listAllCurrenciesCall(_callback); + + } + + + private ApiResponse> listAllCurrenciesWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = listAllCurrenciesValidateBeforeCall(null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call listAllCurrenciesAsync(final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = listAllCurrenciesValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class ListAllCurrenciesRequestBuilderGenerated { + + public ListAllCurrenciesRequestBuilderGenerated() { + } + + /** + * Build call for listAllCurrencies + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of all currencies. -
0 Unexpected error. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return listAllCurrenciesCall(_callback); + } + + + /** + * Execute listAllCurrencies request + * @return List<Currency> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of all currencies. -
0 Unexpected error. -
+ */ + public List execute() throws ApiException { + ApiResponse> localVarResp = listAllCurrenciesWithHttpInfo(); + return localVarResp.getResponseBody(); + } + + /** + * Execute listAllCurrencies request with HTTP info returned + * @return ApiResponse<List<Currency>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of all currencies. -
0 Unexpected error. -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + return listAllCurrenciesWithHttpInfo(); + } + + /** + * Execute listAllCurrencies request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of all currencies. -
0 Unexpected error. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return listAllCurrenciesAsync(_callback); + } + } + + /** + * Get currencies + * Returns a list of all defined Currency objects. + * @return ListAllCurrenciesRequestBuilder + * @http.response.details + + + + +
Status Code Description Response Headers
200 A list of all currencies. -
0 Unexpected error. -
+ */ + public ReferenceDataApi.ListAllCurrenciesRequestBuilder listAllCurrencies() throws IllegalArgumentException { + return ((ReferenceDataApi) this).new ListAllCurrenciesRequestBuilder(); + } + private okhttp3.Call listAllCurrenciesRatesCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/currencies/rates"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listAllCurrenciesRatesValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return listAllCurrenciesRatesCall(_callback); + + } + + + private ApiResponse> listAllCurrenciesRatesWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = listAllCurrenciesRatesValidateBeforeCall(null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call listAllCurrenciesRatesAsync(final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = listAllCurrenciesRatesValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class ListAllCurrenciesRatesRequestBuilderGenerated { + + public ListAllCurrenciesRatesRequestBuilderGenerated() { + } + + /** + * Build call for listAllCurrenciesRates + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 A list of all exchange rates pairs for supported currencies -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return listAllCurrenciesRatesCall(_callback); + } + + + /** + * Execute listAllCurrenciesRates request + * @return List<ExchangeRatePairs> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 A list of all exchange rates pairs for supported currencies -
+ */ + public List execute() throws ApiException { + ApiResponse> localVarResp = listAllCurrenciesRatesWithHttpInfo(); + return localVarResp.getResponseBody(); + } + + /** + * Execute listAllCurrenciesRates request with HTTP info returned + * @return ApiResponse<List<ExchangeRatePairs>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 A list of all exchange rates pairs for supported currencies -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + return listAllCurrenciesRatesWithHttpInfo(); + } + + /** + * Execute listAllCurrenciesRates request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 A list of all exchange rates pairs for supported currencies -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return listAllCurrenciesRatesAsync(_callback); + } + } + + /** + * Get currency exchange rates + * Returns a list of all Exchange Rate Pairs for all supported Currencies. + * @return ListAllCurrenciesRatesRequestBuilder + * @http.response.details + + + +
Status Code Description Response Headers
200 A list of all exchange rates pairs for supported currencies -
+ */ + public ReferenceDataApi.ListAllCurrenciesRatesRequestBuilder listAllCurrenciesRates() throws IllegalArgumentException { + return ((ReferenceDataApi) this).new ListAllCurrenciesRatesRequestBuilder(); + } + private okhttp3.Call symbolSearchUserAccountCall(String userId, String userSecret, UUID accountId, SymbolQuery symbolQuery, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = symbolQuery; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/symbols" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (userId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userId", userId)); + } + + if (userSecret != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userSecret", userSecret)); + } + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call symbolSearchUserAccountValidateBeforeCall(String userId, String userSecret, UUID accountId, SymbolQuery symbolQuery, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException("Missing the required parameter 'userId' when calling symbolSearchUserAccount(Async)"); + } + + // verify the required parameter 'userSecret' is set + if (userSecret == null) { + throw new ApiException("Missing the required parameter 'userSecret' when calling symbolSearchUserAccount(Async)"); + } + + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling symbolSearchUserAccount(Async)"); + } + + return symbolSearchUserAccountCall(userId, userSecret, accountId, symbolQuery, _callback); + + } + + + private ApiResponse> symbolSearchUserAccountWithHttpInfo(String userId, String userSecret, UUID accountId, SymbolQuery symbolQuery) throws ApiException { + okhttp3.Call localVarCall = symbolSearchUserAccountValidateBeforeCall(userId, userSecret, accountId, symbolQuery, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call symbolSearchUserAccountAsync(String userId, String userSecret, UUID accountId, SymbolQuery symbolQuery, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = symbolSearchUserAccountValidateBeforeCall(userId, userSecret, accountId, symbolQuery, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class SymbolSearchUserAccountRequestBuilderGenerated { + final String userId; + final String userSecret; + final UUID accountId; + String substring; + + public SymbolSearchUserAccountRequestBuilderGenerated(String userId, String userSecret, UUID accountId) { + this.userId = userId; + this.userSecret = userSecret; + this.accountId = accountId; + } + + /** + * Set substring + * @param substring (optional) + * @return ReferenceDataApi.SymbolSearchUserAccountRequestBuilder + */ + public ReferenceDataApi.SymbolSearchUserAccountRequestBuilder substring(String substring) { + this.substring = substring; + return (ReferenceDataApi.SymbolSearchUserAccountRequestBuilder) this; + } + + /** + * Build call for symbolSearchUserAccount + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 List of universal symbol supported by account based on substring sent it -
0 Unexpected error -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + SymbolQuery symbolQuery = buildBodyParams(); + return symbolSearchUserAccountCall(userId, userSecret, accountId, symbolQuery, _callback); + } + + private SymbolQuery buildBodyParams() { + SymbolQuery symbolQuery = new SymbolQuery(); + symbolQuery.substring(this.substring); + return symbolQuery; + } + + /** + * Execute symbolSearchUserAccount request + * @return List<UniversalSymbol> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 List of universal symbol supported by account based on substring sent it -
0 Unexpected error -
+ */ + public List execute() throws ApiException { + SymbolQuery symbolQuery = buildBodyParams(); + ApiResponse> localVarResp = symbolSearchUserAccountWithHttpInfo(userId, userSecret, accountId, symbolQuery); + return localVarResp.getResponseBody(); + } + + /** + * Execute symbolSearchUserAccount request with HTTP info returned + * @return ApiResponse<List<UniversalSymbol>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 List of universal symbol supported by account based on substring sent it -
0 Unexpected error -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + SymbolQuery symbolQuery = buildBodyParams(); + return symbolSearchUserAccountWithHttpInfo(userId, userSecret, accountId, symbolQuery); + } + + /** + * Execute symbolSearchUserAccount request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 List of universal symbol supported by account based on substring sent it -
0 Unexpected error -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + SymbolQuery symbolQuery = buildBodyParams(); + return symbolSearchUserAccountAsync(userId, userSecret, accountId, symbolQuery, _callback); + } + } + + /** + * Search for symbols available in an account + * Returns a list of universal symbols that are supported by the specificied account. Returned symbols are based on the provided search string, matching on ticker and name. + * @param userId (required) + * @param userSecret (required) + * @param accountId The ID of the account to search for symbols within. (required) + * @return SymbolSearchUserAccountRequestBuilder + * @http.response.details + + + + +
Status Code Description Response Headers
200 List of universal symbol supported by account based on substring sent it -
0 Unexpected error -
+ */ + public ReferenceDataApi.SymbolSearchUserAccountRequestBuilder symbolSearchUserAccount(String userId, String userSecret, UUID accountId) throws IllegalArgumentException { + if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null"); + + + if (userSecret == null) throw new IllegalArgumentException("\"userSecret\" is required but got null"); + + + if (accountId == null) throw new IllegalArgumentException("\"accountId\" is required but got null"); + + + return ((ReferenceDataApi) this).new SymbolSearchUserAccountRequestBuilder(userId, userSecret, accountId); + } +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/TradingApi.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/TradingApi.java new file mode 100644 index 0000000000..e03e79801d --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/TradingApi.java @@ -0,0 +1,49 @@ +package com.konfigthis.client.api; + +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.model.AccountOrderRecord; +import com.konfigthis.client.model.ActionStrict; +import com.konfigthis.client.model.ManualTradeAndImpact; +import com.konfigthis.client.model.ManualTradeForm; +import com.konfigthis.client.model.OrderTypeStrict; +import com.konfigthis.client.model.SymbolsQuotesInner; +import com.konfigthis.client.model.TimeInForceStrict; +import com.konfigthis.client.model.TradingCancelUserAccountOrderRequest; +import java.util.UUID; +import com.konfigthis.client.model.ValidatedTradeBody; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class TradingApi extends TradingApiGenerated { + + public TradingApi(ApiClient apiClient) throws IllegalArgumentException { + super(apiClient); + } + public class CancelUserAccountOrderRequestBuilder extends CancelUserAccountOrderRequestBuilderGenerated { + public CancelUserAccountOrderRequestBuilder(String userId, String userSecret, UUID accountId) { + super(userId, userSecret, accountId); + } + } + public class GetOrderImpactRequestBuilder extends GetOrderImpactRequestBuilderGenerated { + public GetOrderImpactRequestBuilder(String userId, String userSecret) { + super(userId, userSecret); + } + } + public class GetUserAccountQuotesRequestBuilder extends GetUserAccountQuotesRequestBuilderGenerated { + public GetUserAccountQuotesRequestBuilder(String userId, String userSecret, String symbols, UUID accountId) { + super(userId, userSecret, symbols, accountId); + } + } + public class PlaceForceOrderRequestBuilder extends PlaceForceOrderRequestBuilderGenerated { + public PlaceForceOrderRequestBuilder(String userId, String userSecret) { + super(userId, userSecret); + } + } + public class PlaceOrderRequestBuilder extends PlaceOrderRequestBuilderGenerated { + public PlaceOrderRequestBuilder(UUID tradeId, String userId, String userSecret) { + super(tradeId, userId, userSecret); + } + } +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/TradingApiGenerated.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/TradingApiGenerated.java new file mode 100644 index 0000000000..92e8793fd4 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/TradingApiGenerated.java @@ -0,0 +1,1395 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.api; + +import com.konfigthis.client.ApiCallback; +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.Pair; +import com.konfigthis.client.ProgressRequestBody; +import com.konfigthis.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.konfigthis.client.model.AccountOrderRecord; +import com.konfigthis.client.model.ActionStrict; +import com.konfigthis.client.model.ManualTradeAndImpact; +import com.konfigthis.client.model.ManualTradeForm; +import com.konfigthis.client.model.OrderTypeStrict; +import com.konfigthis.client.model.SymbolsQuotesInner; +import com.konfigthis.client.model.TimeInForceStrict; +import com.konfigthis.client.model.TradingCancelUserAccountOrderRequest; +import java.util.UUID; +import com.konfigthis.client.model.ValidatedTradeBody; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.ws.rs.core.GenericType; + +public class TradingApiGenerated { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public TradingApiGenerated() throws IllegalArgumentException { + this(Configuration.getDefaultApiClient()); + } + + public TradingApiGenerated(ApiClient apiClient) throws IllegalArgumentException { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + private okhttp3.Call cancelUserAccountOrderCall(String userId, String userSecret, UUID accountId, TradingCancelUserAccountOrderRequest tradingCancelUserAccountOrderRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = tradingCancelUserAccountOrderRequest; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/orders/cancel" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (userId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userId", userId)); + } + + if (userSecret != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userSecret", userSecret)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call cancelUserAccountOrderValidateBeforeCall(String userId, String userSecret, UUID accountId, TradingCancelUserAccountOrderRequest tradingCancelUserAccountOrderRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException("Missing the required parameter 'userId' when calling cancelUserAccountOrder(Async)"); + } + + // verify the required parameter 'userSecret' is set + if (userSecret == null) { + throw new ApiException("Missing the required parameter 'userSecret' when calling cancelUserAccountOrder(Async)"); + } + + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling cancelUserAccountOrder(Async)"); + } + + // verify the required parameter 'tradingCancelUserAccountOrderRequest' is set + if (tradingCancelUserAccountOrderRequest == null) { + throw new ApiException("Missing the required parameter 'tradingCancelUserAccountOrderRequest' when calling cancelUserAccountOrder(Async)"); + } + + return cancelUserAccountOrderCall(userId, userSecret, accountId, tradingCancelUserAccountOrderRequest, _callback); + + } + + + private ApiResponse cancelUserAccountOrderWithHttpInfo(String userId, String userSecret, UUID accountId, TradingCancelUserAccountOrderRequest tradingCancelUserAccountOrderRequest) throws ApiException { + okhttp3.Call localVarCall = cancelUserAccountOrderValidateBeforeCall(userId, userSecret, accountId, tradingCancelUserAccountOrderRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call cancelUserAccountOrderAsync(String userId, String userSecret, UUID accountId, TradingCancelUserAccountOrderRequest tradingCancelUserAccountOrderRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = cancelUserAccountOrderValidateBeforeCall(userId, userSecret, accountId, tradingCancelUserAccountOrderRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class CancelUserAccountOrderRequestBuilderGenerated { + final String userId; + final String userSecret; + final UUID accountId; + UUID brokerageOrderId; + + public CancelUserAccountOrderRequestBuilderGenerated(String userId, String userSecret, UUID accountId) { + this.userId = userId; + this.userSecret = userSecret; + this.accountId = accountId; + } + + /** + * Set brokerageOrderId + * @param brokerageOrderId (optional) + * @return TradingApi.CancelUserAccountOrderRequestBuilder + */ + public TradingApi.CancelUserAccountOrderRequestBuilder brokerageOrderId(UUID brokerageOrderId) { + this.brokerageOrderId = brokerageOrderId; + return (TradingApi.CancelUserAccountOrderRequestBuilder) this; + } + + /** + * Build call for cancelUserAccountOrder + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Order Record of canceled order -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + TradingCancelUserAccountOrderRequest tradingCancelUserAccountOrderRequest = buildBodyParams(); + return cancelUserAccountOrderCall(userId, userSecret, accountId, tradingCancelUserAccountOrderRequest, _callback); + } + + private TradingCancelUserAccountOrderRequest buildBodyParams() { + TradingCancelUserAccountOrderRequest tradingCancelUserAccountOrderRequest = new TradingCancelUserAccountOrderRequest(); + tradingCancelUserAccountOrderRequest.brokerageOrderId(this.brokerageOrderId); + return tradingCancelUserAccountOrderRequest; + } + + /** + * Execute cancelUserAccountOrder request + * @return AccountOrderRecord + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Order Record of canceled order -
+ */ + public AccountOrderRecord execute() throws ApiException { + TradingCancelUserAccountOrderRequest tradingCancelUserAccountOrderRequest = buildBodyParams(); + ApiResponse localVarResp = cancelUserAccountOrderWithHttpInfo(userId, userSecret, accountId, tradingCancelUserAccountOrderRequest); + return localVarResp.getResponseBody(); + } + + /** + * Execute cancelUserAccountOrder request with HTTP info returned + * @return ApiResponse<AccountOrderRecord> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Order Record of canceled order -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + TradingCancelUserAccountOrderRequest tradingCancelUserAccountOrderRequest = buildBodyParams(); + return cancelUserAccountOrderWithHttpInfo(userId, userSecret, accountId, tradingCancelUserAccountOrderRequest); + } + + /** + * Execute cancelUserAccountOrder request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Order Record of canceled order -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + TradingCancelUserAccountOrderRequest tradingCancelUserAccountOrderRequest = buildBodyParams(); + return cancelUserAccountOrderAsync(userId, userSecret, accountId, tradingCancelUserAccountOrderRequest, _callback); + } + } + + /** + * Cancel open order in account + * Sends a signal to the brokerage to cancel the specified order. This will only work if the order has not yet been executed. + * @param userId (required) + * @param userSecret (required) + * @param accountId The ID of the account to cancel the order in. (required) + * @param tradingCancelUserAccountOrderRequest The Order ID to be canceled (required) + * @return CancelUserAccountOrderRequestBuilder + * @http.response.details + + + +
Status Code Description Response Headers
200 Order Record of canceled order -
+ */ + public TradingApi.CancelUserAccountOrderRequestBuilder cancelUserAccountOrder(String userId, String userSecret, UUID accountId) throws IllegalArgumentException { + if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null"); + + + if (userSecret == null) throw new IllegalArgumentException("\"userSecret\" is required but got null"); + + + if (accountId == null) throw new IllegalArgumentException("\"accountId\" is required but got null"); + + + return ((TradingApi) this).new CancelUserAccountOrderRequestBuilder(userId, userSecret, accountId); + } + private okhttp3.Call getOrderImpactCall(String userId, String userSecret, ManualTradeForm manualTradeForm, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = manualTradeForm; + + // create path and map variables + String localVarPath = "/trade/impact"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (userId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userId", userId)); + } + + if (userSecret != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userSecret", userSecret)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getOrderImpactValidateBeforeCall(String userId, String userSecret, ManualTradeForm manualTradeForm, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException("Missing the required parameter 'userId' when calling getOrderImpact(Async)"); + } + + // verify the required parameter 'userSecret' is set + if (userSecret == null) { + throw new ApiException("Missing the required parameter 'userSecret' when calling getOrderImpact(Async)"); + } + + // verify the required parameter 'manualTradeForm' is set + if (manualTradeForm == null) { + throw new ApiException("Missing the required parameter 'manualTradeForm' when calling getOrderImpact(Async)"); + } + + return getOrderImpactCall(userId, userSecret, manualTradeForm, _callback); + + } + + + private ApiResponse getOrderImpactWithHttpInfo(String userId, String userSecret, ManualTradeForm manualTradeForm) throws ApiException { + okhttp3.Call localVarCall = getOrderImpactValidateBeforeCall(userId, userSecret, manualTradeForm, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getOrderImpactAsync(String userId, String userSecret, ManualTradeForm manualTradeForm, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getOrderImpactValidateBeforeCall(userId, userSecret, manualTradeForm, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class GetOrderImpactRequestBuilderGenerated { + final String userId; + final String userSecret; + UUID accountId; + ActionStrict action; + OrderTypeStrict orderType; + Double price; + Double stop; + TimeInForceStrict timeInForce; + Double units; + UUID universalSymbolId; + Object notionalValue; + + public GetOrderImpactRequestBuilderGenerated(String userId, String userSecret) { + this.userId = userId; + this.userSecret = userSecret; + } + + /** + * Set accountId + * @param accountId (optional) + * @return TradingApi.GetOrderImpactRequestBuilder + */ + public TradingApi.GetOrderImpactRequestBuilder accountId(UUID accountId) { + this.accountId = accountId; + return (TradingApi.GetOrderImpactRequestBuilder) this; + } + + /** + * Set action + * @param action (optional) + * @return TradingApi.GetOrderImpactRequestBuilder + */ + public TradingApi.GetOrderImpactRequestBuilder action(ActionStrict action) { + this.action = action; + return (TradingApi.GetOrderImpactRequestBuilder) this; + } + + /** + * Set orderType + * @param orderType (optional) + * @return TradingApi.GetOrderImpactRequestBuilder + */ + public TradingApi.GetOrderImpactRequestBuilder orderType(OrderTypeStrict orderType) { + this.orderType = orderType; + return (TradingApi.GetOrderImpactRequestBuilder) this; + } + + /** + * Set price + * @param price Trade Price if limit or stop limit order (optional) + * @return TradingApi.GetOrderImpactRequestBuilder + */ + public TradingApi.GetOrderImpactRequestBuilder price(Double price) { + this.price = price; + return (TradingApi.GetOrderImpactRequestBuilder) this; + } + + + /** + * Set price + * @param price Trade Price if limit or stop limit order (optional) + * @return TradingApi.GetOrderImpactRequestBuilder + */ + public TradingApi.GetOrderImpactRequestBuilder price(Integer price) { + this.price = price.doubleValue(); + return (TradingApi.GetOrderImpactRequestBuilder) this; + } + + /** + * Set stop + * @param stop Stop Price. If stop loss or stop limit order, the price to trigger the stop (optional) + * @return TradingApi.GetOrderImpactRequestBuilder + */ + public TradingApi.GetOrderImpactRequestBuilder stop(Double stop) { + this.stop = stop; + return (TradingApi.GetOrderImpactRequestBuilder) this; + } + + + /** + * Set stop + * @param stop Stop Price. If stop loss or stop limit order, the price to trigger the stop (optional) + * @return TradingApi.GetOrderImpactRequestBuilder + */ + public TradingApi.GetOrderImpactRequestBuilder stop(Integer stop) { + this.stop = stop.doubleValue(); + return (TradingApi.GetOrderImpactRequestBuilder) this; + } + + /** + * Set timeInForce + * @param timeInForce (optional) + * @return TradingApi.GetOrderImpactRequestBuilder + */ + public TradingApi.GetOrderImpactRequestBuilder timeInForce(TimeInForceStrict timeInForce) { + this.timeInForce = timeInForce; + return (TradingApi.GetOrderImpactRequestBuilder) this; + } + + /** + * Set units + * @param units Trade Units. Cannot work with notional value. (optional) + * @return TradingApi.GetOrderImpactRequestBuilder + */ + public TradingApi.GetOrderImpactRequestBuilder units(Double units) { + this.units = units; + return (TradingApi.GetOrderImpactRequestBuilder) this; + } + + + /** + * Set units + * @param units Trade Units. Cannot work with notional value. (optional) + * @return TradingApi.GetOrderImpactRequestBuilder + */ + public TradingApi.GetOrderImpactRequestBuilder units(Integer units) { + this.units = units.doubleValue(); + return (TradingApi.GetOrderImpactRequestBuilder) this; + } + + /** + * Set universalSymbolId + * @param universalSymbolId (optional) + * @return TradingApi.GetOrderImpactRequestBuilder + */ + public TradingApi.GetOrderImpactRequestBuilder universalSymbolId(UUID universalSymbolId) { + this.universalSymbolId = universalSymbolId; + return (TradingApi.GetOrderImpactRequestBuilder) this; + } + + /** + * Set notionalValue + * @param notionalValue (optional) + * @return TradingApi.GetOrderImpactRequestBuilder + */ + public TradingApi.GetOrderImpactRequestBuilder notionalValue(Object notionalValue) { + this.notionalValue = notionalValue; + return (TradingApi.GetOrderImpactRequestBuilder) this; + } + + /** + * Build call for getOrderImpact + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Return trade object and it's impact on the account -
500 Unexpected Error -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + ManualTradeForm manualTradeForm = buildBodyParams(); + return getOrderImpactCall(userId, userSecret, manualTradeForm, _callback); + } + + private ManualTradeForm buildBodyParams() { + ManualTradeForm manualTradeForm = new ManualTradeForm(); + manualTradeForm.accountId(this.accountId); + manualTradeForm.action(this.action); + manualTradeForm.orderType(this.orderType); + manualTradeForm.price(this.price); + manualTradeForm.stop(this.stop); + manualTradeForm.timeInForce(this.timeInForce); + manualTradeForm.units(this.units); + manualTradeForm.universalSymbolId(this.universalSymbolId); + manualTradeForm.notionalValue(this.notionalValue); + return manualTradeForm; + } + + /** + * Execute getOrderImpact request + * @return ManualTradeAndImpact + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Return trade object and it's impact on the account -
500 Unexpected Error -
+ */ + public ManualTradeAndImpact execute() throws ApiException { + ManualTradeForm manualTradeForm = buildBodyParams(); + ApiResponse localVarResp = getOrderImpactWithHttpInfo(userId, userSecret, manualTradeForm); + return localVarResp.getResponseBody(); + } + + /** + * Execute getOrderImpact request with HTTP info returned + * @return ApiResponse<ManualTradeAndImpact> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Return trade object and it's impact on the account -
500 Unexpected Error -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + ManualTradeForm manualTradeForm = buildBodyParams(); + return getOrderImpactWithHttpInfo(userId, userSecret, manualTradeForm); + } + + /** + * Execute getOrderImpact request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Return trade object and it's impact on the account -
500 Unexpected Error -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + ManualTradeForm manualTradeForm = buildBodyParams(); + return getOrderImpactAsync(userId, userSecret, manualTradeForm, _callback); + } + } + + /** + * Check the impact of a trade on an account + * Return the trade object and it's impact on the account for the specified order. + * @param userId (required) + * @param userSecret (required) + * @param manualTradeForm (required) + * @return GetOrderImpactRequestBuilder + * @http.response.details + + + + +
Status Code Description Response Headers
200 Return trade object and it's impact on the account -
500 Unexpected Error -
+ */ + public TradingApi.GetOrderImpactRequestBuilder getOrderImpact(String userId, String userSecret) throws IllegalArgumentException { + if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null"); + + + if (userSecret == null) throw new IllegalArgumentException("\"userSecret\" is required but got null"); + + + return ((TradingApi) this).new GetOrderImpactRequestBuilder(userId, userSecret); + } + private okhttp3.Call getUserAccountQuotesCall(String userId, String userSecret, String symbols, UUID accountId, Boolean useTicker, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/quotes" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (userId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userId", userId)); + } + + if (userSecret != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userSecret", userSecret)); + } + + if (symbols != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("symbols", symbols)); + } + + if (useTicker != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("use_ticker", useTicker)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUserAccountQuotesValidateBeforeCall(String userId, String userSecret, String symbols, UUID accountId, Boolean useTicker, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException("Missing the required parameter 'userId' when calling getUserAccountQuotes(Async)"); + } + + // verify the required parameter 'userSecret' is set + if (userSecret == null) { + throw new ApiException("Missing the required parameter 'userSecret' when calling getUserAccountQuotes(Async)"); + } + + // verify the required parameter 'symbols' is set + if (symbols == null) { + throw new ApiException("Missing the required parameter 'symbols' when calling getUserAccountQuotes(Async)"); + } + + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling getUserAccountQuotes(Async)"); + } + + return getUserAccountQuotesCall(userId, userSecret, symbols, accountId, useTicker, _callback); + + } + + + private ApiResponse> getUserAccountQuotesWithHttpInfo(String userId, String userSecret, String symbols, UUID accountId, Boolean useTicker) throws ApiException { + okhttp3.Call localVarCall = getUserAccountQuotesValidateBeforeCall(userId, userSecret, symbols, accountId, useTicker, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getUserAccountQuotesAsync(String userId, String userSecret, String symbols, UUID accountId, Boolean useTicker, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getUserAccountQuotesValidateBeforeCall(userId, userSecret, symbols, accountId, useTicker, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class GetUserAccountQuotesRequestBuilderGenerated { + final String userId; + final String userSecret; + final String symbols; + final UUID accountId; + Boolean useTicker; + + public GetUserAccountQuotesRequestBuilderGenerated(String userId, String userSecret, String symbols, UUID accountId) { + this.userId = userId; + this.userSecret = userSecret; + this.symbols = symbols; + this.accountId = accountId; + } + + /** + * Set useTicker + * @param useTicker Should be set to True if providing tickers. (optional) + * @return TradingApi.GetUserAccountQuotesRequestBuilder + */ + public TradingApi.GetUserAccountQuotesRequestBuilder useTicker(Boolean useTicker) { + this.useTicker = useTicker; + return (TradingApi.GetUserAccountQuotesRequestBuilder) this; + } + + /** + * Build call for getUserAccountQuotes + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Returns quotes object with different prices -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getUserAccountQuotesCall(userId, userSecret, symbols, accountId, useTicker, _callback); + } + + + /** + * Execute getUserAccountQuotes request + * @return List<SymbolsQuotesInner> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Returns quotes object with different prices -
+ */ + public List execute() throws ApiException { + ApiResponse> localVarResp = getUserAccountQuotesWithHttpInfo(userId, userSecret, symbols, accountId, useTicker); + return localVarResp.getResponseBody(); + } + + /** + * Execute getUserAccountQuotes request with HTTP info returned + * @return ApiResponse<List<SymbolsQuotesInner>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + +
Status Code Description Response Headers
200 Returns quotes object with different prices -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + return getUserAccountQuotesWithHttpInfo(userId, userSecret, symbols, accountId, useTicker); + } + + /** + * Execute getUserAccountQuotes request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + +
Status Code Description Response Headers
200 Returns quotes object with different prices -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return getUserAccountQuotesAsync(userId, userSecret, symbols, accountId, useTicker, _callback); + } + } + + /** + * Get symbol quotes + * Returns quote(s) from the brokerage for the specified symbol(s). + * @param userId (required) + * @param userSecret (required) + * @param symbols List of universal_symbol_id or tickers to get quotes for. (required) + * @param accountId The ID of the account to get quotes. (required) + * @return GetUserAccountQuotesRequestBuilder + * @http.response.details + + + +
Status Code Description Response Headers
200 Returns quotes object with different prices -
+ */ + public TradingApi.GetUserAccountQuotesRequestBuilder getUserAccountQuotes(String userId, String userSecret, String symbols, UUID accountId) throws IllegalArgumentException { + if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null"); + + + if (userSecret == null) throw new IllegalArgumentException("\"userSecret\" is required but got null"); + + + if (symbols == null) throw new IllegalArgumentException("\"symbols\" is required but got null"); + + + if (accountId == null) throw new IllegalArgumentException("\"accountId\" is required but got null"); + + + return ((TradingApi) this).new GetUserAccountQuotesRequestBuilder(userId, userSecret, symbols, accountId); + } + private okhttp3.Call placeForceOrderCall(String userId, String userSecret, ManualTradeForm manualTradeForm, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = manualTradeForm; + + // create path and map variables + String localVarPath = "/trade/place"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (userId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userId", userId)); + } + + if (userSecret != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userSecret", userSecret)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call placeForceOrderValidateBeforeCall(String userId, String userSecret, ManualTradeForm manualTradeForm, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException("Missing the required parameter 'userId' when calling placeForceOrder(Async)"); + } + + // verify the required parameter 'userSecret' is set + if (userSecret == null) { + throw new ApiException("Missing the required parameter 'userSecret' when calling placeForceOrder(Async)"); + } + + // verify the required parameter 'manualTradeForm' is set + if (manualTradeForm == null) { + throw new ApiException("Missing the required parameter 'manualTradeForm' when calling placeForceOrder(Async)"); + } + + return placeForceOrderCall(userId, userSecret, manualTradeForm, _callback); + + } + + + private ApiResponse placeForceOrderWithHttpInfo(String userId, String userSecret, ManualTradeForm manualTradeForm) throws ApiException { + okhttp3.Call localVarCall = placeForceOrderValidateBeforeCall(userId, userSecret, manualTradeForm, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call placeForceOrderAsync(String userId, String userSecret, ManualTradeForm manualTradeForm, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = placeForceOrderValidateBeforeCall(userId, userSecret, manualTradeForm, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class PlaceForceOrderRequestBuilderGenerated { + final String userId; + final String userSecret; + UUID accountId; + ActionStrict action; + OrderTypeStrict orderType; + Double price; + Double stop; + TimeInForceStrict timeInForce; + Double units; + UUID universalSymbolId; + Object notionalValue; + + public PlaceForceOrderRequestBuilderGenerated(String userId, String userSecret) { + this.userId = userId; + this.userSecret = userSecret; + } + + /** + * Set accountId + * @param accountId (optional) + * @return TradingApi.PlaceForceOrderRequestBuilder + */ + public TradingApi.PlaceForceOrderRequestBuilder accountId(UUID accountId) { + this.accountId = accountId; + return (TradingApi.PlaceForceOrderRequestBuilder) this; + } + + /** + * Set action + * @param action (optional) + * @return TradingApi.PlaceForceOrderRequestBuilder + */ + public TradingApi.PlaceForceOrderRequestBuilder action(ActionStrict action) { + this.action = action; + return (TradingApi.PlaceForceOrderRequestBuilder) this; + } + + /** + * Set orderType + * @param orderType (optional) + * @return TradingApi.PlaceForceOrderRequestBuilder + */ + public TradingApi.PlaceForceOrderRequestBuilder orderType(OrderTypeStrict orderType) { + this.orderType = orderType; + return (TradingApi.PlaceForceOrderRequestBuilder) this; + } + + /** + * Set price + * @param price Trade Price if limit or stop limit order (optional) + * @return TradingApi.PlaceForceOrderRequestBuilder + */ + public TradingApi.PlaceForceOrderRequestBuilder price(Double price) { + this.price = price; + return (TradingApi.PlaceForceOrderRequestBuilder) this; + } + + + /** + * Set price + * @param price Trade Price if limit or stop limit order (optional) + * @return TradingApi.PlaceForceOrderRequestBuilder + */ + public TradingApi.PlaceForceOrderRequestBuilder price(Integer price) { + this.price = price.doubleValue(); + return (TradingApi.PlaceForceOrderRequestBuilder) this; + } + + /** + * Set stop + * @param stop Stop Price. If stop loss or stop limit order, the price to trigger the stop (optional) + * @return TradingApi.PlaceForceOrderRequestBuilder + */ + public TradingApi.PlaceForceOrderRequestBuilder stop(Double stop) { + this.stop = stop; + return (TradingApi.PlaceForceOrderRequestBuilder) this; + } + + + /** + * Set stop + * @param stop Stop Price. If stop loss or stop limit order, the price to trigger the stop (optional) + * @return TradingApi.PlaceForceOrderRequestBuilder + */ + public TradingApi.PlaceForceOrderRequestBuilder stop(Integer stop) { + this.stop = stop.doubleValue(); + return (TradingApi.PlaceForceOrderRequestBuilder) this; + } + + /** + * Set timeInForce + * @param timeInForce (optional) + * @return TradingApi.PlaceForceOrderRequestBuilder + */ + public TradingApi.PlaceForceOrderRequestBuilder timeInForce(TimeInForceStrict timeInForce) { + this.timeInForce = timeInForce; + return (TradingApi.PlaceForceOrderRequestBuilder) this; + } + + /** + * Set units + * @param units Trade Units. Cannot work with notional value. (optional) + * @return TradingApi.PlaceForceOrderRequestBuilder + */ + public TradingApi.PlaceForceOrderRequestBuilder units(Double units) { + this.units = units; + return (TradingApi.PlaceForceOrderRequestBuilder) this; + } + + + /** + * Set units + * @param units Trade Units. Cannot work with notional value. (optional) + * @return TradingApi.PlaceForceOrderRequestBuilder + */ + public TradingApi.PlaceForceOrderRequestBuilder units(Integer units) { + this.units = units.doubleValue(); + return (TradingApi.PlaceForceOrderRequestBuilder) this; + } + + /** + * Set universalSymbolId + * @param universalSymbolId (optional) + * @return TradingApi.PlaceForceOrderRequestBuilder + */ + public TradingApi.PlaceForceOrderRequestBuilder universalSymbolId(UUID universalSymbolId) { + this.universalSymbolId = universalSymbolId; + return (TradingApi.PlaceForceOrderRequestBuilder) this; + } + + /** + * Set notionalValue + * @param notionalValue (optional) + * @return TradingApi.PlaceForceOrderRequestBuilder + */ + public TradingApi.PlaceForceOrderRequestBuilder notionalValue(Object notionalValue) { + this.notionalValue = notionalValue; + return (TradingApi.PlaceForceOrderRequestBuilder) this; + } + + /** + * Build call for placeForceOrder + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Trade sucessfully placed -
500 Unexpected Error -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + ManualTradeForm manualTradeForm = buildBodyParams(); + return placeForceOrderCall(userId, userSecret, manualTradeForm, _callback); + } + + private ManualTradeForm buildBodyParams() { + ManualTradeForm manualTradeForm = new ManualTradeForm(); + manualTradeForm.accountId(this.accountId); + manualTradeForm.action(this.action); + manualTradeForm.orderType(this.orderType); + manualTradeForm.price(this.price); + manualTradeForm.stop(this.stop); + manualTradeForm.timeInForce(this.timeInForce); + manualTradeForm.units(this.units); + manualTradeForm.universalSymbolId(this.universalSymbolId); + manualTradeForm.notionalValue(this.notionalValue); + return manualTradeForm; + } + + /** + * Execute placeForceOrder request + * @return AccountOrderRecord + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Trade sucessfully placed -
500 Unexpected Error -
+ */ + public AccountOrderRecord execute() throws ApiException { + ManualTradeForm manualTradeForm = buildBodyParams(); + ApiResponse localVarResp = placeForceOrderWithHttpInfo(userId, userSecret, manualTradeForm); + return localVarResp.getResponseBody(); + } + + /** + * Execute placeForceOrder request with HTTP info returned + * @return ApiResponse<AccountOrderRecord> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Trade sucessfully placed -
500 Unexpected Error -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + ManualTradeForm manualTradeForm = buildBodyParams(); + return placeForceOrderWithHttpInfo(userId, userSecret, manualTradeForm); + } + + /** + * Execute placeForceOrder request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Trade sucessfully placed -
500 Unexpected Error -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + ManualTradeForm manualTradeForm = buildBodyParams(); + return placeForceOrderAsync(userId, userSecret, manualTradeForm, _callback); + } + } + + /** + * Place a trade with NO validation. + * Places a specified trade in the specified account. + * @param userId (required) + * @param userSecret (required) + * @param manualTradeForm (required) + * @return PlaceForceOrderRequestBuilder + * @http.response.details + + + + +
Status Code Description Response Headers
200 Trade sucessfully placed -
500 Unexpected Error -
+ */ + public TradingApi.PlaceForceOrderRequestBuilder placeForceOrder(String userId, String userSecret) throws IllegalArgumentException { + if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null"); + + + if (userSecret == null) throw new IllegalArgumentException("\"userSecret\" is required but got null"); + + + return ((TradingApi) this).new PlaceForceOrderRequestBuilder(userId, userSecret); + } + private okhttp3.Call placeOrderCall(UUID tradeId, String userId, String userSecret, ValidatedTradeBody validatedTradeBody, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = validatedTradeBody; + + // create path and map variables + String localVarPath = "/trade/{tradeId}" + .replace("{" + "tradeId" + "}", localVarApiClient.escapeString(tradeId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (userId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userId", userId)); + } + + if (userSecret != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userSecret", userSecret)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call placeOrderValidateBeforeCall(UUID tradeId, String userId, String userSecret, ValidatedTradeBody validatedTradeBody, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'tradeId' is set + if (tradeId == null) { + throw new ApiException("Missing the required parameter 'tradeId' when calling placeOrder(Async)"); + } + + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException("Missing the required parameter 'userId' when calling placeOrder(Async)"); + } + + // verify the required parameter 'userSecret' is set + if (userSecret == null) { + throw new ApiException("Missing the required parameter 'userSecret' when calling placeOrder(Async)"); + } + + return placeOrderCall(tradeId, userId, userSecret, validatedTradeBody, _callback); + + } + + + private ApiResponse placeOrderWithHttpInfo(UUID tradeId, String userId, String userSecret, ValidatedTradeBody validatedTradeBody) throws ApiException { + okhttp3.Call localVarCall = placeOrderValidateBeforeCall(tradeId, userId, userSecret, validatedTradeBody, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call placeOrderAsync(UUID tradeId, String userId, String userSecret, ValidatedTradeBody validatedTradeBody, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = placeOrderValidateBeforeCall(tradeId, userId, userSecret, validatedTradeBody, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class PlaceOrderRequestBuilderGenerated { + final UUID tradeId; + final String userId; + final String userSecret; + Boolean waitToConfirm; + + public PlaceOrderRequestBuilderGenerated(UUID tradeId, String userId, String userSecret) { + this.tradeId = tradeId; + this.userId = userId; + this.userSecret = userSecret; + } + + /** + * Set waitToConfirm + * @param waitToConfirm Optional, defaults to true. Determines if a wait is performed to check on order status. If false, latency will be reduced but orders returned will be more likely to be of status PENDING as we will not wait to check on the status before responding to the request (optional) + * @return TradingApi.PlaceOrderRequestBuilder + */ + public TradingApi.PlaceOrderRequestBuilder waitToConfirm(Boolean waitToConfirm) { + this.waitToConfirm = waitToConfirm; + return (TradingApi.PlaceOrderRequestBuilder) this; + } + + /** + * Build call for placeOrder + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Status of order placed -
500 Unexpected Error -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + ValidatedTradeBody validatedTradeBody = buildBodyParams(); + return placeOrderCall(tradeId, userId, userSecret, validatedTradeBody, _callback); + } + + private ValidatedTradeBody buildBodyParams() { + ValidatedTradeBody validatedTradeBody = new ValidatedTradeBody(); + validatedTradeBody.waitToConfirm(this.waitToConfirm); + return validatedTradeBody; + } + + /** + * Execute placeOrder request + * @return AccountOrderRecord + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Status of order placed -
500 Unexpected Error -
+ */ + public AccountOrderRecord execute() throws ApiException { + ValidatedTradeBody validatedTradeBody = buildBodyParams(); + ApiResponse localVarResp = placeOrderWithHttpInfo(tradeId, userId, userSecret, validatedTradeBody); + return localVarResp.getResponseBody(); + } + + /** + * Execute placeOrder request with HTTP info returned + * @return ApiResponse<AccountOrderRecord> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Status of order placed -
500 Unexpected Error -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + ValidatedTradeBody validatedTradeBody = buildBodyParams(); + return placeOrderWithHttpInfo(tradeId, userId, userSecret, validatedTradeBody); + } + + /** + * Execute placeOrder request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Status of order placed -
500 Unexpected Error -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + ValidatedTradeBody validatedTradeBody = buildBodyParams(); + return placeOrderAsync(tradeId, userId, userSecret, validatedTradeBody, _callback); + } + } + + /** + * Place order + * Places the specified trade object. This places the order in the account and returns the status of the order from the brokerage. + * @param tradeId The ID of trade object obtained from trade/impact endpoint (required) + * @param userId (required) + * @param userSecret (required) + * @return PlaceOrderRequestBuilder + * @http.response.details + + + + +
Status Code Description Response Headers
200 Status of order placed -
500 Unexpected Error -
+ */ + public TradingApi.PlaceOrderRequestBuilder placeOrder(UUID tradeId, String userId, String userSecret) throws IllegalArgumentException { + if (tradeId == null) throw new IllegalArgumentException("\"tradeId\" is required but got null"); + + + if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null"); + + + if (userSecret == null) throw new IllegalArgumentException("\"userSecret\" is required but got null"); + + + return ((TradingApi) this).new PlaceOrderRequestBuilder(tradeId, userId, userSecret); + } +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/TransactionsAndReportingApi.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/TransactionsAndReportingApi.java new file mode 100644 index 0000000000..6461775437 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/TransactionsAndReportingApi.java @@ -0,0 +1,27 @@ +package com.konfigthis.client.api; + +import com.konfigthis.client.ApiClient; +import java.time.LocalDate; +import com.konfigthis.client.model.PerformanceCustom; +import com.konfigthis.client.model.UniversalActivity; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class TransactionsAndReportingApi extends TransactionsAndReportingApiGenerated { + + public TransactionsAndReportingApi(ApiClient apiClient) throws IllegalArgumentException { + super(apiClient); + } + public class GetActivitiesRequestBuilder extends GetActivitiesRequestBuilderGenerated { + public GetActivitiesRequestBuilder(String userId, String userSecret) { + super(userId, userSecret); + } + } + public class GetReportingCustomRangeRequestBuilder extends GetReportingCustomRangeRequestBuilderGenerated { + public GetReportingCustomRangeRequestBuilder(LocalDate startDate, LocalDate endDate, String userId, String userSecret) { + super(startDate, endDate, userId, userSecret); + } + } +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/TransactionsAndReportingApiGenerated.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/TransactionsAndReportingApiGenerated.java new file mode 100644 index 0000000000..d7d3ce8a59 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/api/TransactionsAndReportingApiGenerated.java @@ -0,0 +1,592 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.api; + +import com.konfigthis.client.ApiCallback; +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiResponse; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.Pair; +import com.konfigthis.client.ProgressRequestBody; +import com.konfigthis.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import java.time.LocalDate; +import com.konfigthis.client.model.PerformanceCustom; +import com.konfigthis.client.model.UniversalActivity; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.ws.rs.core.GenericType; + +public class TransactionsAndReportingApiGenerated { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public TransactionsAndReportingApiGenerated() throws IllegalArgumentException { + this(Configuration.getDefaultApiClient()); + } + + public TransactionsAndReportingApiGenerated(ApiClient apiClient) throws IllegalArgumentException { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + private okhttp3.Call getActivitiesCall(String userId, String userSecret, LocalDate startDate, LocalDate endDate, String accounts, String brokerageAuthorizations, String type, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/activities"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (startDate != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("startDate", startDate)); + } + + if (endDate != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("endDate", endDate)); + } + + if (accounts != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("accounts", accounts)); + } + + if (brokerageAuthorizations != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("brokerageAuthorizations", brokerageAuthorizations)); + } + + if (type != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("type", type)); + } + + if (userId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userId", userId)); + } + + if (userSecret != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userSecret", userSecret)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getActivitiesValidateBeforeCall(String userId, String userSecret, LocalDate startDate, LocalDate endDate, String accounts, String brokerageAuthorizations, String type, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException("Missing the required parameter 'userId' when calling getActivities(Async)"); + } + + // verify the required parameter 'userSecret' is set + if (userSecret == null) { + throw new ApiException("Missing the required parameter 'userSecret' when calling getActivities(Async)"); + } + + return getActivitiesCall(userId, userSecret, startDate, endDate, accounts, brokerageAuthorizations, type, _callback); + + } + + + private ApiResponse> getActivitiesWithHttpInfo(String userId, String userSecret, LocalDate startDate, LocalDate endDate, String accounts, String brokerageAuthorizations, String type) throws ApiException { + okhttp3.Call localVarCall = getActivitiesValidateBeforeCall(userId, userSecret, startDate, endDate, accounts, brokerageAuthorizations, type, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getActivitiesAsync(String userId, String userSecret, LocalDate startDate, LocalDate endDate, String accounts, String brokerageAuthorizations, String type, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getActivitiesValidateBeforeCall(userId, userSecret, startDate, endDate, accounts, brokerageAuthorizations, type, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class GetActivitiesRequestBuilderGenerated { + final String userId; + final String userSecret; + LocalDate startDate; + LocalDate endDate; + String accounts; + String brokerageAuthorizations; + String type; + + public GetActivitiesRequestBuilderGenerated(String userId, String userSecret) { + this.userId = userId; + this.userSecret = userSecret; + } + + /** + * Set startDate + * @param startDate (optional) + * @return TransactionsAndReportingApi.GetActivitiesRequestBuilder + */ + public TransactionsAndReportingApi.GetActivitiesRequestBuilder startDate(LocalDate startDate) { + this.startDate = startDate; + return (TransactionsAndReportingApi.GetActivitiesRequestBuilder) this; + } + + /** + * Set endDate + * @param endDate (optional) + * @return TransactionsAndReportingApi.GetActivitiesRequestBuilder + */ + public TransactionsAndReportingApi.GetActivitiesRequestBuilder endDate(LocalDate endDate) { + this.endDate = endDate; + return (TransactionsAndReportingApi.GetActivitiesRequestBuilder) this; + } + + /** + * Set accounts + * @param accounts Optional comma seperated list of account IDs used to filter the request on specific accounts (optional) + * @return TransactionsAndReportingApi.GetActivitiesRequestBuilder + */ + public TransactionsAndReportingApi.GetActivitiesRequestBuilder accounts(String accounts) { + this.accounts = accounts; + return (TransactionsAndReportingApi.GetActivitiesRequestBuilder) this; + } + + /** + * Set brokerageAuthorizations + * @param brokerageAuthorizations Optional comma seperated list of brokerage authorization IDs used to filter the request on only accounts that belong to those authorizations (optional) + * @return TransactionsAndReportingApi.GetActivitiesRequestBuilder + */ + public TransactionsAndReportingApi.GetActivitiesRequestBuilder brokerageAuthorizations(String brokerageAuthorizations) { + this.brokerageAuthorizations = brokerageAuthorizations; + return (TransactionsAndReportingApi.GetActivitiesRequestBuilder) this; + } + + /** + * Set type + * @param type Optional comma seperated list of types to filter activities by. This is not an exhaustive list, if we fail to match to these types, we will return the raw description from the brokerage. Potential values include - DIVIDEND - BUY - SELL - CONTRIBUTION - WITHDRAWAL - EXTERNAL_ASSET_TRANSFER_IN - EXTERNAL_ASSET_TRANSFER_OUT - INTERNAL_CASH_TRANSFER_IN - INTERNAL_CASH_TRANSFER_OUT - INTERNAL_ASSET_TRANSFER_IN - INTERNAL_ASSET_TRANSFER_OUT - INTEREST - REBATE - GOV_GRANT - TAX - FEE - REI - FXT (optional) + * @return TransactionsAndReportingApi.GetActivitiesRequestBuilder + */ + public TransactionsAndReportingApi.GetActivitiesRequestBuilder type(String type) { + this.type = type; + return (TransactionsAndReportingApi.GetActivitiesRequestBuilder) this; + } + + /** + * Build call for getActivities + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successfully retrieved transaction history -
0 Unexpected error -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getActivitiesCall(userId, userSecret, startDate, endDate, accounts, brokerageAuthorizations, type, _callback); + } + + + /** + * Execute getActivities request + * @return List<UniversalActivity> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successfully retrieved transaction history -
0 Unexpected error -
+ */ + public List execute() throws ApiException { + ApiResponse> localVarResp = getActivitiesWithHttpInfo(userId, userSecret, startDate, endDate, accounts, brokerageAuthorizations, type); + return localVarResp.getResponseBody(); + } + + /** + * Execute getActivities request with HTTP info returned + * @return ApiResponse<List<UniversalActivity>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successfully retrieved transaction history -
0 Unexpected error -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + return getActivitiesWithHttpInfo(userId, userSecret, startDate, endDate, accounts, brokerageAuthorizations, type); + } + + /** + * Execute getActivities request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successfully retrieved transaction history -
0 Unexpected error -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return getActivitiesAsync(userId, userSecret, startDate, endDate, accounts, brokerageAuthorizations, type, _callback); + } + } + + /** + * Get transaction history for a user + * Returns activities (transactions) for a user. Specifying start and end date is highly recommended for better performance + * @param userId (required) + * @param userSecret (required) + * @return GetActivitiesRequestBuilder + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successfully retrieved transaction history -
0 Unexpected error -
+ */ + public TransactionsAndReportingApi.GetActivitiesRequestBuilder getActivities(String userId, String userSecret) throws IllegalArgumentException { + if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null"); + + + if (userSecret == null) throw new IllegalArgumentException("\"userSecret\" is required but got null"); + + + return ((TransactionsAndReportingApi) this).new GetActivitiesRequestBuilder(userId, userSecret); + } + private okhttp3.Call getReportingCustomRangeCall(LocalDate startDate, LocalDate endDate, String userId, String userSecret, String accounts, Boolean detailed, String frequency, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/performance/custom"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (startDate != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("startDate", startDate)); + } + + if (endDate != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("endDate", endDate)); + } + + if (accounts != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("accounts", accounts)); + } + + if (detailed != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("detailed", detailed)); + } + + if (frequency != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("frequency", frequency)); + } + + if (userId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userId", userId)); + } + + if (userSecret != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("userSecret", userSecret)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call getReportingCustomRangeValidateBeforeCall(LocalDate startDate, LocalDate endDate, String userId, String userSecret, String accounts, Boolean detailed, String frequency, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'startDate' is set + if (startDate == null) { + throw new ApiException("Missing the required parameter 'startDate' when calling getReportingCustomRange(Async)"); + } + + // verify the required parameter 'endDate' is set + if (endDate == null) { + throw new ApiException("Missing the required parameter 'endDate' when calling getReportingCustomRange(Async)"); + } + + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException("Missing the required parameter 'userId' when calling getReportingCustomRange(Async)"); + } + + // verify the required parameter 'userSecret' is set + if (userSecret == null) { + throw new ApiException("Missing the required parameter 'userSecret' when calling getReportingCustomRange(Async)"); + } + + return getReportingCustomRangeCall(startDate, endDate, userId, userSecret, accounts, detailed, frequency, _callback); + + } + + + private ApiResponse getReportingCustomRangeWithHttpInfo(LocalDate startDate, LocalDate endDate, String userId, String userSecret, String accounts, Boolean detailed, String frequency) throws ApiException { + okhttp3.Call localVarCall = getReportingCustomRangeValidateBeforeCall(startDate, endDate, userId, userSecret, accounts, detailed, frequency, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getReportingCustomRangeAsync(LocalDate startDate, LocalDate endDate, String userId, String userSecret, String accounts, Boolean detailed, String frequency, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getReportingCustomRangeValidateBeforeCall(startDate, endDate, userId, userSecret, accounts, detailed, frequency, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public abstract class GetReportingCustomRangeRequestBuilderGenerated { + final LocalDate startDate; + final LocalDate endDate; + final String userId; + final String userSecret; + String accounts; + Boolean detailed; + String frequency; + + public GetReportingCustomRangeRequestBuilderGenerated(LocalDate startDate, LocalDate endDate, String userId, String userSecret) { + this.startDate = startDate; + this.endDate = endDate; + this.userId = userId; + this.userSecret = userSecret; + } + + /** + * Set accounts + * @param accounts Optional comma seperated list of account IDs used to filter the request on specific accounts (optional) + * @return TransactionsAndReportingApi.GetReportingCustomRangeRequestBuilder + */ + public TransactionsAndReportingApi.GetReportingCustomRangeRequestBuilder accounts(String accounts) { + this.accounts = accounts; + return (TransactionsAndReportingApi.GetReportingCustomRangeRequestBuilder) this; + } + + /** + * Set detailed + * @param detailed Optional, increases frequency of data points for the total value and contribution charts if set to true (optional) + * @return TransactionsAndReportingApi.GetReportingCustomRangeRequestBuilder + */ + public TransactionsAndReportingApi.GetReportingCustomRangeRequestBuilder detailed(Boolean detailed) { + this.detailed = detailed; + return (TransactionsAndReportingApi.GetReportingCustomRangeRequestBuilder) this; + } + + /** + * Set frequency + * @param frequency Optional frequency for the rate of return chart (defaults to monthly). Possible values are daily, weekly, monthly, quarterly, yearly. (optional) + * @return TransactionsAndReportingApi.GetReportingCustomRangeRequestBuilder + */ + public TransactionsAndReportingApi.GetReportingCustomRangeRequestBuilder frequency(String frequency) { + this.frequency = frequency; + return (TransactionsAndReportingApi.GetReportingCustomRangeRequestBuilder) this; + } + + /** + * Build call for getReportingCustomRange + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successfully retrieved performance data -
0 Unexpected error -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getReportingCustomRangeCall(startDate, endDate, userId, userSecret, accounts, detailed, frequency, _callback); + } + + + /** + * Execute getReportingCustomRange request + * @return PerformanceCustom + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successfully retrieved performance data -
0 Unexpected error -
+ * @deprecated + */ + @Deprecated + public PerformanceCustom execute() throws ApiException { + ApiResponse localVarResp = getReportingCustomRangeWithHttpInfo(startDate, endDate, userId, userSecret, accounts, detailed, frequency); + return localVarResp.getResponseBody(); + } + + /** + * Execute getReportingCustomRange request with HTTP info returned + * @return ApiResponse<PerformanceCustom> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successfully retrieved performance data -
0 Unexpected error -
+ * @deprecated + */ + @Deprecated + public ApiResponse executeWithHttpInfo() throws ApiException { + return getReportingCustomRangeWithHttpInfo(startDate, endDate, userId, userSecret, accounts, detailed, frequency); + } + + /** + * Execute getReportingCustomRange request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successfully retrieved performance data -
0 Unexpected error -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getReportingCustomRangeAsync(startDate, endDate, userId, userSecret, accounts, detailed, frequency, _callback); + } + } + + /** + * Get performance information for a specific timeframe + * Returns performance information (contributions, dividends, rate of return, etc) for a specific timeframe. Please note that Total Equity Timeframe and Rate of Returns are experimental features. Please contact support@snaptrade.com if you notice any inconsistencies. + * @param startDate (required) + * @param endDate (required) + * @param userId (required) + * @param userSecret (required) + * @return GetReportingCustomRangeRequestBuilder + * @http.response.details + + + + +
Status Code Description Response Headers
200 Successfully retrieved performance data -
0 Unexpected error -
+ * @deprecated + */ + @Deprecated + public TransactionsAndReportingApi.GetReportingCustomRangeRequestBuilder getReportingCustomRange(LocalDate startDate, LocalDate endDate, String userId, String userSecret) throws IllegalArgumentException { + if (startDate == null) throw new IllegalArgumentException("\"startDate\" is required but got null"); + if (endDate == null) throw new IllegalArgumentException("\"endDate\" is required but got null"); + if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null"); + + + if (userSecret == null) throw new IllegalArgumentException("\"userSecret\" is required but got null"); + + + return ((TransactionsAndReportingApi) this).new GetReportingCustomRangeRequestBuilder(startDate, endDate, userId, userSecret); + } +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/auth/ApiKeyAuth.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/auth/ApiKeyAuth.java new file mode 100644 index 0000000000..c3d69dab65 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/auth/ApiKeyAuth.java @@ -0,0 +1,84 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.auth; + +import com.konfigthis.client.ApiException; +import com.konfigthis.client.Pair; + +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class ApiKeyAuth implements Authentication { + private final String location; + private final String paramName; + + private String apiKey; + private String apiKeyPrefix; + + public ApiKeyAuth(String location, String paramName) { + this.location = location; + this.paramName = paramName; + } + + public ApiKeyAuth(String location, String paramName, String prefix) { + this.location = location; + this.paramName = paramName; + this.apiKeyPrefix = prefix; + } + + public String getLocation() { + return location; + } + + public String getParamName() { + return paramName; + } + + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public String getApiKeyPrefix() { + return apiKeyPrefix; + } + + public void setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method) throws ApiException { + if (apiKey == null) { + return; + } + String value; + if (apiKeyPrefix != null) { + value = apiKeyPrefix + apiKey; + } else { + value = apiKey; + } + if ("query".equals(location)) { + queryParams.add(new Pair(paramName, value)); + } else if ("header".equals(location)) { + headerParams.put(paramName, value); + } else if ("cookie".equals(location)) { + cookieParams.put(paramName, value); + } + } +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/auth/Authentication.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/auth/Authentication.java new file mode 100644 index 0000000000..e8323d67e5 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/auth/Authentication.java @@ -0,0 +1,33 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.auth; + +import com.konfigthis.client.Pair; +import com.konfigthis.client.ApiException; + +import java.util.Map; +import java.util.List; + +public interface Authentication { + /** + * Apply authentication settings to header and query params. + * + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + * @param cookieParams Map of cookie parameters + * @param payload HTTP request body + * @param method HTTP method + * @throws ApiException if failed to update the parameters + */ + void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method) throws ApiException; +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/auth/HttpBasicAuth.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/auth/HttpBasicAuth.java new file mode 100644 index 0000000000..bfa6a431cc --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/auth/HttpBasicAuth.java @@ -0,0 +1,55 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.auth; + +import com.konfigthis.client.Pair; +import com.konfigthis.client.ApiException; + +import okhttp3.Credentials; + +import java.util.Map; +import java.util.List; + +import java.io.UnsupportedEncodingException; + +public class HttpBasicAuth implements Authentication { + private String username; + private String password; + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method) throws ApiException { + if (username == null && password == null) { + return; + } + headerParams.put("Authorization", Credentials.basic( + username == null ? "" : username, + password == null ? "" : password)); + } +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/auth/HttpBearerAuth.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/auth/HttpBearerAuth.java new file mode 100644 index 0000000000..a78bf155b8 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/auth/HttpBearerAuth.java @@ -0,0 +1,61 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.auth; + +import com.konfigthis.client.ApiException; +import com.konfigthis.client.Pair; + +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class HttpBearerAuth implements Authentication { + private final String scheme; + private String bearerToken; + + public HttpBearerAuth(String scheme) { + this.scheme = scheme; + } + + /** + * Gets the token, which together with the scheme, will be sent as the value of the Authorization header. + * + * @return The bearer token + */ + public String getBearerToken() { + return bearerToken; + } + + /** + * Sets the token, which together with the scheme, will be sent as the value of the Authorization header. + * + * @param bearerToken The bearer token to send in the Authorization header + */ + public void setBearerToken(String bearerToken) { + this.bearerToken = bearerToken; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method) throws ApiException { + if (bearerToken == null) { + return; + } + + headerParams.put("Authorization", (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken); + } + + private static String upperCaseBearer(String scheme) { + return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme; + } +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/AbstractOpenApiSchema.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/AbstractOpenApiSchema.java new file mode 100644 index 0000000000..825ee20269 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/AbstractOpenApiSchema.java @@ -0,0 +1,147 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.konfigthis.client.ApiException; +import java.util.Objects; +import java.lang.reflect.Type; +import java.util.Map; +import javax.ws.rs.core.GenericType; + +//import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public abstract class AbstractOpenApiSchema { + + // store the actual instance of the schema/object + private Object instance; + + // is nullable + private Boolean isNullable; + + // schema type (e.g. oneOf, anyOf) + private final String schemaType; + + public AbstractOpenApiSchema(String schemaType, Boolean isNullable) { + this.schemaType = schemaType; + this.isNullable = isNullable; + } + + /** + * Get the list of oneOf/anyOf composed schemas allowed to be stored in this object + * + * @return an instance of the actual schema/object + */ + public abstract Map getSchemas(); + + /** + * Get the actual instance + * + * @return an instance of the actual schema/object + */ + //@JsonValue + public Object getActualInstance() {return instance;} + + /** + * Set the actual instance + * + * @param instance the actual instance of the schema/object + */ + public void setActualInstance(Object instance) {this.instance = instance;} + + /** + * Get the instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well + * + * @return an instance of the actual schema/object + */ + public Object getActualInstanceRecursively() { + return getActualInstanceRecursively(this); + } + + private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { + if (object.getActualInstance() == null) { + return null; + } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { + return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance()); + } else { + return object.getActualInstance(); + } + } + + /** + * Get the schema type (e.g. anyOf, oneOf) + * + * @return the schema type + */ + public String getSchemaType() { + return schemaType; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ").append(getClass()).append(" {\n"); + sb.append(" instance: ").append(toIndentedString(instance)).append("\n"); + sb.append(" isNullable: ").append(toIndentedString(isNullable)).append("\n"); + sb.append(" schemaType: ").append(toIndentedString(schemaType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AbstractOpenApiSchema a = (AbstractOpenApiSchema) o; + return Objects.equals(this.instance, a.instance) && + Objects.equals(this.isNullable, a.isNullable) && + Objects.equals(this.schemaType, a.schemaType); + } + + @Override + public int hashCode() { + return Objects.hash(instance, isNullable, schemaType); + } + + /** + * Is nullable + * + * @return true if it's nullable + */ + public Boolean isNullable() { + if (Boolean.TRUE.equals(isNullable)) { + return Boolean.TRUE; + } else { + return Boolean.FALSE; + } + } + + + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/Account.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/Account.java new file mode 100644 index 0000000000..84e91519f2 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/Account.java @@ -0,0 +1,715 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.AccountBalance; +import com.konfigthis.client.model.AccountSyncStatus; +import com.konfigthis.client.model.CashRestriction; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * SnapTradeUser Investment Account + */ +@ApiModel(description = "SnapTradeUser Investment Account")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class Account { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private UUID id; + + public static final String SERIALIZED_NAME_BROKERAGE_AUTHORIZATION = "brokerage_authorization"; + @SerializedName(SERIALIZED_NAME_BROKERAGE_AUTHORIZATION) + private UUID brokerageAuthorization; + + public static final String SERIALIZED_NAME_PORTFOLIO_GROUP = "portfolio_group"; + @SerializedName(SERIALIZED_NAME_PORTFOLIO_GROUP) + private UUID portfolioGroup; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_NUMBER = "number"; + @SerializedName(SERIALIZED_NAME_NUMBER) + private String number; + + public static final String SERIALIZED_NAME_INSTITUTION_NAME = "institution_name"; + @SerializedName(SERIALIZED_NAME_INSTITUTION_NAME) + private String institutionName; + + public static final String SERIALIZED_NAME_CREATED_DATE = "created_date"; + @SerializedName(SERIALIZED_NAME_CREATED_DATE) + private String createdDate; + + public static final String SERIALIZED_NAME_META = "meta"; + @SerializedName(SERIALIZED_NAME_META) + private Map meta = null; + + public static final String SERIALIZED_NAME_CASH_RESTRICTIONS = "cash_restrictions"; + @SerializedName(SERIALIZED_NAME_CASH_RESTRICTIONS) + private List cashRestrictions = null; + + public static final String SERIALIZED_NAME_SYNC_STATUS = "sync_status"; + @SerializedName(SERIALIZED_NAME_SYNC_STATUS) + private AccountSyncStatus syncStatus; + + public static final String SERIALIZED_NAME_BALANCE = "balance"; + @SerializedName(SERIALIZED_NAME_BALANCE) + private AccountBalance balance; + + public Account() { + } + + public Account id(UUID id) { + + + + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getId() { + return id; + } + + + public void setId(UUID id) { + + + + this.id = id; + } + + + public Account brokerageAuthorization(UUID brokerageAuthorization) { + + + + + this.brokerageAuthorization = brokerageAuthorization; + return this; + } + + /** + * Get brokerageAuthorization + * @return brokerageAuthorization + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getBrokerageAuthorization() { + return brokerageAuthorization; + } + + + public void setBrokerageAuthorization(UUID brokerageAuthorization) { + + + + this.brokerageAuthorization = brokerageAuthorization; + } + + + public Account portfolioGroup(UUID portfolioGroup) { + + + + + this.portfolioGroup = portfolioGroup; + return this; + } + + /** + * Get portfolioGroup + * @return portfolioGroup + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getPortfolioGroup() { + return portfolioGroup; + } + + + public void setPortfolioGroup(UUID portfolioGroup) { + + + + this.portfolioGroup = portfolioGroup; + } + + + public Account name(String name) { + + + + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Registered Retirement Savings Account", value = "") + + public String getName() { + return name; + } + + + public void setName(String name) { + + + + this.name = name; + } + + + public Account number(String number) { + + + + + this.number = number; + return this; + } + + /** + * Get number + * @return number + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Q6542138443", value = "") + + public String getNumber() { + return number; + } + + + public void setNumber(String number) { + + + + this.number = number; + } + + + public Account institutionName(String institutionName) { + + + + + this.institutionName = institutionName; + return this; + } + + /** + * Get institutionName + * @return institutionName + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Alpaca", value = "") + + public String getInstitutionName() { + return institutionName; + } + + + public void setInstitutionName(String institutionName) { + + + + this.institutionName = institutionName; + } + + + public Account createdDate(String createdDate) { + + + + + this.createdDate = createdDate; + return this; + } + + /** + * Get createdDate + * @return createdDate + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2021-06-04T16:26:46.523Z", value = "") + + public String getCreatedDate() { + return createdDate; + } + + + public void setCreatedDate(String createdDate) { + + + + this.createdDate = createdDate; + } + + + public Account meta(Map meta) { + + + + + this.meta = meta; + return this; + } + + public Account putMetaItem(String key, Object metaItem) { + if (this.meta == null) { + this.meta = new HashMap<>(); + } + this.meta.put(key, metaItem); + return this; + } + + /** + * Get meta + * @return meta + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "{\"type\":\"Margin\",\"status\":\"ACTIVE\",\"institution_name\":\"Alpaca\"}", value = "") + + public Map getMeta() { + return meta; + } + + + public void setMeta(Map meta) { + + + + this.meta = meta; + } + + + public Account cashRestrictions(List cashRestrictions) { + + + + + this.cashRestrictions = cashRestrictions; + return this; + } + + public Account addCashRestrictionsItem(CashRestriction cashRestrictionsItem) { + if (this.cashRestrictions == null) { + this.cashRestrictions = new ArrayList<>(); + } + this.cashRestrictions.add(cashRestrictionsItem); + return this; + } + + /** + * Get cashRestrictions + * @return cashRestrictions + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public List getCashRestrictions() { + return cashRestrictions; + } + + + public void setCashRestrictions(List cashRestrictions) { + + + + this.cashRestrictions = cashRestrictions; + } + + + public Account syncStatus(AccountSyncStatus syncStatus) { + + + + + this.syncStatus = syncStatus; + return this; + } + + /** + * Get syncStatus + * @return syncStatus + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public AccountSyncStatus getSyncStatus() { + return syncStatus; + } + + + public void setSyncStatus(AccountSyncStatus syncStatus) { + + + + this.syncStatus = syncStatus; + } + + + public Account balance(AccountBalance balance) { + + + + + this.balance = balance; + return this; + } + + /** + * Get balance + * @return balance + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public AccountBalance getBalance() { + return balance; + } + + + public void setBalance(AccountBalance balance) { + + + + this.balance = balance; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Account instance itself + */ + public Account putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Account account = (Account) o; + return Objects.equals(this.id, account.id) && + Objects.equals(this.brokerageAuthorization, account.brokerageAuthorization) && + Objects.equals(this.portfolioGroup, account.portfolioGroup) && + Objects.equals(this.name, account.name) && + Objects.equals(this.number, account.number) && + Objects.equals(this.institutionName, account.institutionName) && + Objects.equals(this.createdDate, account.createdDate) && + Objects.equals(this.meta, account.meta) && + Objects.equals(this.cashRestrictions, account.cashRestrictions) && + Objects.equals(this.syncStatus, account.syncStatus) && + Objects.equals(this.balance, account.balance)&& + Objects.equals(this.additionalProperties, account.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, brokerageAuthorization, portfolioGroup, name, number, institutionName, createdDate, meta, cashRestrictions, syncStatus, balance, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Account {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" brokerageAuthorization: ").append(toIndentedString(brokerageAuthorization)).append("\n"); + sb.append(" portfolioGroup: ").append(toIndentedString(portfolioGroup)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" number: ").append(toIndentedString(number)).append("\n"); + sb.append(" institutionName: ").append(toIndentedString(institutionName)).append("\n"); + sb.append(" createdDate: ").append(toIndentedString(createdDate)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).append("\n"); + sb.append(" cashRestrictions: ").append(toIndentedString(cashRestrictions)).append("\n"); + sb.append(" syncStatus: ").append(toIndentedString(syncStatus)).append("\n"); + sb.append(" balance: ").append(toIndentedString(balance)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("brokerage_authorization"); + openapiFields.add("portfolio_group"); + openapiFields.add("name"); + openapiFields.add("number"); + openapiFields.add("institution_name"); + openapiFields.add("created_date"); + openapiFields.add("meta"); + openapiFields.add("cash_restrictions"); + openapiFields.add("sync_status"); + openapiFields.add("balance"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to Account + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!Account.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Account is not found in the empty JSON string", Account.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("brokerage_authorization") != null && !jsonObj.get("brokerage_authorization").isJsonNull()) && !jsonObj.get("brokerage_authorization").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `brokerage_authorization` to be a primitive type in the JSON string but got `%s`", jsonObj.get("brokerage_authorization").toString())); + } + if ((jsonObj.get("portfolio_group") != null && !jsonObj.get("portfolio_group").isJsonNull()) && !jsonObj.get("portfolio_group").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `portfolio_group` to be a primitive type in the JSON string but got `%s`", jsonObj.get("portfolio_group").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("number") != null && !jsonObj.get("number").isJsonNull()) && !jsonObj.get("number").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `number` to be a primitive type in the JSON string but got `%s`", jsonObj.get("number").toString())); + } + if ((jsonObj.get("institution_name") != null && !jsonObj.get("institution_name").isJsonNull()) && !jsonObj.get("institution_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `institution_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("institution_name").toString())); + } + if ((jsonObj.get("created_date") != null && !jsonObj.get("created_date").isJsonNull()) && !jsonObj.get("created_date").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `created_date` to be a primitive type in the JSON string but got `%s`", jsonObj.get("created_date").toString())); + } + if (jsonObj.get("cash_restrictions") != null && !jsonObj.get("cash_restrictions").isJsonNull()) { + JsonArray jsonArraycashRestrictions = jsonObj.getAsJsonArray("cash_restrictions"); + if (jsonArraycashRestrictions != null) { + // ensure the json data is an array + if (!jsonObj.get("cash_restrictions").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `cash_restrictions` to be an array in the JSON string but got `%s`", jsonObj.get("cash_restrictions").toString())); + } + + // validate the optional field `cash_restrictions` (array) + for (int i = 0; i < jsonArraycashRestrictions.size(); i++) { + CashRestriction.validateJsonObject(jsonArraycashRestrictions.get(i).getAsJsonObject()); + }; + } + } + // validate the optional field `sync_status` + if (jsonObj.get("sync_status") != null && !jsonObj.get("sync_status").isJsonNull()) { + AccountSyncStatus.validateJsonObject(jsonObj.getAsJsonObject("sync_status")); + } + // validate the optional field `balance` + if (jsonObj.get("balance") != null && !jsonObj.get("balance").isJsonNull()) { + AccountBalance.validateJsonObject(jsonObj.getAsJsonObject("balance")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Account.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Account' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Account.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Account value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Account read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + Account instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Account given an JSON string + * + * @param jsonString JSON string + * @return An instance of Account + * @throws IOException if the JSON string is invalid with respect to Account + */ + public static Account fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Account.class); + } + + /** + * Convert an instance of Account to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/AccountBalance.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/AccountBalance.java new file mode 100644 index 0000000000..230e7767b3 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/AccountBalance.java @@ -0,0 +1,305 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.AmountNullable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Contains balance related information for the account. + */ +@ApiModel(description = "Contains balance related information for the account.")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class AccountBalance { + public static final String SERIALIZED_NAME_TOTAL = "total"; + @SerializedName(SERIALIZED_NAME_TOTAL) + private AmountNullable total; + + public AccountBalance() { + } + + public AccountBalance total(AmountNullable total) { + + + + + this.total = total; + return this; + } + + /** + * Get total + * @return total + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public AmountNullable getTotal() { + return total; + } + + + public void setTotal(AmountNullable total) { + + + + this.total = total; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AccountBalance instance itself + */ + public AccountBalance putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AccountBalance accountBalance = (AccountBalance) o; + return Objects.equals(this.total, accountBalance.total)&& + Objects.equals(this.additionalProperties, accountBalance.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(total, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AccountBalance {\n"); + sb.append(" total: ").append(toIndentedString(total)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("total"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to AccountBalance + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!AccountBalance.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AccountBalance is not found in the empty JSON string", AccountBalance.openapiRequiredFields.toString())); + } + } + // validate the optional field `total` + if (jsonObj.get("total") != null && !jsonObj.get("total").isJsonNull()) { + AmountNullable.validateJsonObject(jsonObj.getAsJsonObject("total")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AccountBalance.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AccountBalance' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AccountBalance.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AccountBalance value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AccountBalance read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + AccountBalance instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AccountBalance given an JSON string + * + * @param jsonString JSON string + * @return An instance of AccountBalance + * @throws IOException if the JSON string is invalid with respect to AccountBalance + */ + public static AccountBalance fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AccountBalance.class); + } + + /** + * Convert an instance of AccountBalance to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/AccountBalanceNullable.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/AccountBalanceNullable.java new file mode 100644 index 0000000000..8ef1f17edc --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/AccountBalanceNullable.java @@ -0,0 +1,305 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.AmountNullable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Contains balance related information for the account. + */ +@ApiModel(description = "Contains balance related information for the account.")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class AccountBalanceNullable { + public static final String SERIALIZED_NAME_TOTAL = "total"; + @SerializedName(SERIALIZED_NAME_TOTAL) + private AmountNullable total; + + public AccountBalanceNullable() { + } + + public AccountBalanceNullable total(AmountNullable total) { + + + + + this.total = total; + return this; + } + + /** + * Get total + * @return total + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public AmountNullable getTotal() { + return total; + } + + + public void setTotal(AmountNullable total) { + + + + this.total = total; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AccountBalanceNullable instance itself + */ + public AccountBalanceNullable putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AccountBalanceNullable accountBalanceNullable = (AccountBalanceNullable) o; + return Objects.equals(this.total, accountBalanceNullable.total)&& + Objects.equals(this.additionalProperties, accountBalanceNullable.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(total, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AccountBalanceNullable {\n"); + sb.append(" total: ").append(toIndentedString(total)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("total"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to AccountBalanceNullable + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!AccountBalanceNullable.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AccountBalanceNullable is not found in the empty JSON string", AccountBalanceNullable.openapiRequiredFields.toString())); + } + } + // validate the optional field `total` + if (jsonObj.get("total") != null && !jsonObj.get("total").isJsonNull()) { + AmountNullable.validateJsonObject(jsonObj.getAsJsonObject("total")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AccountBalanceNullable.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AccountBalanceNullable' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AccountBalanceNullable.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AccountBalanceNullable value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AccountBalanceNullable read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + AccountBalanceNullable instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AccountBalanceNullable given an JSON string + * + * @param jsonString JSON string + * @return An instance of AccountBalanceNullable + * @throws IOException if the JSON string is invalid with respect to AccountBalanceNullable + */ + public static AccountBalanceNullable fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AccountBalanceNullable.class); + } + + /** + * Convert an instance of AccountBalanceNullable to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/AccountHoldings.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/AccountHoldings.java new file mode 100644 index 0000000000..5badf24cc3 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/AccountHoldings.java @@ -0,0 +1,466 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.Balance; +import com.konfigthis.client.model.Position; +import com.konfigthis.client.model.SnapTradeHoldingsAccount; +import com.konfigthis.client.model.SnapTradeHoldingsTotalValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Account Holdings + */ +@ApiModel(description = "Account Holdings")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class AccountHoldings { + public static final String SERIALIZED_NAME_ACCOUNT = "account"; + @SerializedName(SERIALIZED_NAME_ACCOUNT) + private SnapTradeHoldingsAccount account; + + public static final String SERIALIZED_NAME_BALANCES = "balances"; + @SerializedName(SERIALIZED_NAME_BALANCES) + private List balances = null; + + public static final String SERIALIZED_NAME_POSITIONS = "positions"; + @SerializedName(SERIALIZED_NAME_POSITIONS) + private List positions = null; + + public static final String SERIALIZED_NAME_TOTAL_VALUE = "total_value"; + @SerializedName(SERIALIZED_NAME_TOTAL_VALUE) + private SnapTradeHoldingsTotalValue totalValue; + + public AccountHoldings() { + } + + public AccountHoldings account(SnapTradeHoldingsAccount account) { + + + + + this.account = account; + return this; + } + + /** + * Get account + * @return account + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public SnapTradeHoldingsAccount getAccount() { + return account; + } + + + public void setAccount(SnapTradeHoldingsAccount account) { + + + + this.account = account; + } + + + public AccountHoldings balances(List balances) { + + + + + this.balances = balances; + return this; + } + + public AccountHoldings addBalancesItem(Balance balancesItem) { + if (this.balances == null) { + this.balances = new ArrayList<>(); + } + this.balances.add(balancesItem); + return this; + } + + /** + * Get balances + * @return balances + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public List getBalances() { + return balances; + } + + + public void setBalances(List balances) { + + + + this.balances = balances; + } + + + public AccountHoldings positions(List positions) { + + + + + this.positions = positions; + return this; + } + + public AccountHoldings addPositionsItem(Position positionsItem) { + if (this.positions == null) { + this.positions = new ArrayList<>(); + } + this.positions.add(positionsItem); + return this; + } + + /** + * Get positions + * @return positions + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public List getPositions() { + return positions; + } + + + public void setPositions(List positions) { + + + + this.positions = positions; + } + + + public AccountHoldings totalValue(SnapTradeHoldingsTotalValue totalValue) { + + + + + this.totalValue = totalValue; + return this; + } + + /** + * Get totalValue + * @return totalValue + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public SnapTradeHoldingsTotalValue getTotalValue() { + return totalValue; + } + + + public void setTotalValue(SnapTradeHoldingsTotalValue totalValue) { + + + + this.totalValue = totalValue; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AccountHoldings instance itself + */ + public AccountHoldings putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AccountHoldings accountHoldings = (AccountHoldings) o; + return Objects.equals(this.account, accountHoldings.account) && + Objects.equals(this.balances, accountHoldings.balances) && + Objects.equals(this.positions, accountHoldings.positions) && + Objects.equals(this.totalValue, accountHoldings.totalValue)&& + Objects.equals(this.additionalProperties, accountHoldings.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(account, balances, positions, totalValue, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AccountHoldings {\n"); + sb.append(" account: ").append(toIndentedString(account)).append("\n"); + sb.append(" balances: ").append(toIndentedString(balances)).append("\n"); + sb.append(" positions: ").append(toIndentedString(positions)).append("\n"); + sb.append(" totalValue: ").append(toIndentedString(totalValue)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("account"); + openapiFields.add("balances"); + openapiFields.add("positions"); + openapiFields.add("total_value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to AccountHoldings + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!AccountHoldings.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AccountHoldings is not found in the empty JSON string", AccountHoldings.openapiRequiredFields.toString())); + } + } + // validate the optional field `account` + if (jsonObj.get("account") != null && !jsonObj.get("account").isJsonNull()) { + SnapTradeHoldingsAccount.validateJsonObject(jsonObj.getAsJsonObject("account")); + } + if (jsonObj.get("balances") != null && !jsonObj.get("balances").isJsonNull()) { + JsonArray jsonArraybalances = jsonObj.getAsJsonArray("balances"); + if (jsonArraybalances != null) { + // ensure the json data is an array + if (!jsonObj.get("balances").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `balances` to be an array in the JSON string but got `%s`", jsonObj.get("balances").toString())); + } + + // validate the optional field `balances` (array) + for (int i = 0; i < jsonArraybalances.size(); i++) { + Balance.validateJsonObject(jsonArraybalances.get(i).getAsJsonObject()); + }; + } + } + if (jsonObj.get("positions") != null && !jsonObj.get("positions").isJsonNull()) { + JsonArray jsonArraypositions = jsonObj.getAsJsonArray("positions"); + if (jsonArraypositions != null) { + // ensure the json data is an array + if (!jsonObj.get("positions").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `positions` to be an array in the JSON string but got `%s`", jsonObj.get("positions").toString())); + } + + // validate the optional field `positions` (array) + for (int i = 0; i < jsonArraypositions.size(); i++) { + Position.validateJsonObject(jsonArraypositions.get(i).getAsJsonObject()); + }; + } + } + // validate the optional field `total_value` + if (jsonObj.get("total_value") != null && !jsonObj.get("total_value").isJsonNull()) { + SnapTradeHoldingsTotalValue.validateJsonObject(jsonObj.getAsJsonObject("total_value")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AccountHoldings.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AccountHoldings' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AccountHoldings.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AccountHoldings value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AccountHoldings read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + AccountHoldings instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AccountHoldings given an JSON string + * + * @param jsonString JSON string + * @return An instance of AccountHoldings + * @throws IOException if the JSON string is invalid with respect to AccountHoldings + */ + public static AccountHoldings fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AccountHoldings.class); + } + + /** + * Convert an instance of AccountHoldings to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/AccountHoldingsAccount.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/AccountHoldingsAccount.java new file mode 100644 index 0000000000..60d4f8abda --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/AccountHoldingsAccount.java @@ -0,0 +1,584 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.AccountOrderRecord; +import com.konfigthis.client.model.Balance; +import com.konfigthis.client.model.OptionsPosition; +import com.konfigthis.client.model.Position; +import com.konfigthis.client.model.SnapTradeHoldingsAccountAccountId; +import com.konfigthis.client.model.SnapTradeHoldingsTotalValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * A wrapper object containing holdings information for a single account + */ +@ApiModel(description = "A wrapper object containing holdings information for a single account")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class AccountHoldingsAccount { + public static final String SERIALIZED_NAME_ACCOUNT = "account"; + @SerializedName(SERIALIZED_NAME_ACCOUNT) + private SnapTradeHoldingsAccountAccountId account; + + public static final String SERIALIZED_NAME_BALANCES = "balances"; + @SerializedName(SERIALIZED_NAME_BALANCES) + private List balances = null; + + public static final String SERIALIZED_NAME_POSITIONS = "positions"; + @SerializedName(SERIALIZED_NAME_POSITIONS) + private List positions = null; + + public static final String SERIALIZED_NAME_OPTION_POSITIONS = "option_positions"; + @SerializedName(SERIALIZED_NAME_OPTION_POSITIONS) + private List optionPositions = null; + + public static final String SERIALIZED_NAME_ORDERS = "orders"; + @SerializedName(SERIALIZED_NAME_ORDERS) + private List orders = null; + + public static final String SERIALIZED_NAME_TOTAL_VALUE = "total_value"; + @SerializedName(SERIALIZED_NAME_TOTAL_VALUE) + private SnapTradeHoldingsTotalValue totalValue; + + public AccountHoldingsAccount() { + } + + public AccountHoldingsAccount account(SnapTradeHoldingsAccountAccountId account) { + + + + + this.account = account; + return this; + } + + /** + * Get account + * @return account + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public SnapTradeHoldingsAccountAccountId getAccount() { + return account; + } + + + public void setAccount(SnapTradeHoldingsAccountAccountId account) { + + + + this.account = account; + } + + + public AccountHoldingsAccount balances(List balances) { + + + + + this.balances = balances; + return this; + } + + public AccountHoldingsAccount addBalancesItem(Balance balancesItem) { + if (this.balances == null) { + this.balances = new ArrayList<>(); + } + this.balances.add(balancesItem); + return this; + } + + /** + * List of balances for the account. Each element of the list has a distinct currency. Some brokerages like Questrade [allows holding multiple currencies in the same account](https://www.questrade.com/learning/questrade-basics/balances-and-reports/understanding-your-account-balances). + * @return balances + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of balances for the account. Each element of the list has a distinct currency. Some brokerages like Questrade [allows holding multiple currencies in the same account](https://www.questrade.com/learning/questrade-basics/balances-and-reports/understanding-your-account-balances).") + + public List getBalances() { + return balances; + } + + + public void setBalances(List balances) { + + + + this.balances = balances; + } + + + public AccountHoldingsAccount positions(List positions) { + + + + + this.positions = positions; + return this; + } + + public AccountHoldingsAccount addPositionsItem(Position positionsItem) { + if (this.positions == null) { + this.positions = new ArrayList<>(); + } + this.positions.add(positionsItem); + return this; + } + + /** + * List of stock/ETF/crypto/mutual fund positions in the account. + * @return positions + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of stock/ETF/crypto/mutual fund positions in the account.") + + public List getPositions() { + return positions; + } + + + public void setPositions(List positions) { + + + + this.positions = positions; + } + + + public AccountHoldingsAccount optionPositions(List optionPositions) { + + + + + this.optionPositions = optionPositions; + return this; + } + + public AccountHoldingsAccount addOptionPositionsItem(OptionsPosition optionPositionsItem) { + if (this.optionPositions == null) { + this.optionPositions = new ArrayList<>(); + } + this.optionPositions.add(optionPositionsItem); + return this; + } + + /** + * List of option positions in the account. + * @return optionPositions + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of option positions in the account.") + + public List getOptionPositions() { + return optionPositions; + } + + + public void setOptionPositions(List optionPositions) { + + + + this.optionPositions = optionPositions; + } + + + public AccountHoldingsAccount orders(List orders) { + + + + + this.orders = orders; + return this; + } + + public AccountHoldingsAccount addOrdersItem(AccountOrderRecord ordersItem) { + if (this.orders == null) { + this.orders = new ArrayList<>(); + } + this.orders.add(ordersItem); + return this; + } + + /** + * List of recent orders in the account, including both pending and executed orders. + * @return orders + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of recent orders in the account, including both pending and executed orders.") + + public List getOrders() { + return orders; + } + + + public void setOrders(List orders) { + + + + this.orders = orders; + } + + + public AccountHoldingsAccount totalValue(SnapTradeHoldingsTotalValue totalValue) { + + + + + this.totalValue = totalValue; + return this; + } + + /** + * Get totalValue + * @return totalValue + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public SnapTradeHoldingsTotalValue getTotalValue() { + return totalValue; + } + + + public void setTotalValue(SnapTradeHoldingsTotalValue totalValue) { + + + + this.totalValue = totalValue; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AccountHoldingsAccount instance itself + */ + public AccountHoldingsAccount putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AccountHoldingsAccount accountHoldingsAccount = (AccountHoldingsAccount) o; + return Objects.equals(this.account, accountHoldingsAccount.account) && + Objects.equals(this.balances, accountHoldingsAccount.balances) && + Objects.equals(this.positions, accountHoldingsAccount.positions) && + Objects.equals(this.optionPositions, accountHoldingsAccount.optionPositions) && + Objects.equals(this.orders, accountHoldingsAccount.orders) && + Objects.equals(this.totalValue, accountHoldingsAccount.totalValue)&& + Objects.equals(this.additionalProperties, accountHoldingsAccount.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(account, balances, positions, optionPositions, orders, totalValue, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AccountHoldingsAccount {\n"); + sb.append(" account: ").append(toIndentedString(account)).append("\n"); + sb.append(" balances: ").append(toIndentedString(balances)).append("\n"); + sb.append(" positions: ").append(toIndentedString(positions)).append("\n"); + sb.append(" optionPositions: ").append(toIndentedString(optionPositions)).append("\n"); + sb.append(" orders: ").append(toIndentedString(orders)).append("\n"); + sb.append(" totalValue: ").append(toIndentedString(totalValue)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("account"); + openapiFields.add("balances"); + openapiFields.add("positions"); + openapiFields.add("option_positions"); + openapiFields.add("orders"); + openapiFields.add("total_value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to AccountHoldingsAccount + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!AccountHoldingsAccount.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AccountHoldingsAccount is not found in the empty JSON string", AccountHoldingsAccount.openapiRequiredFields.toString())); + } + } + // validate the optional field `account` + if (jsonObj.get("account") != null && !jsonObj.get("account").isJsonNull()) { + SnapTradeHoldingsAccountAccountId.validateJsonObject(jsonObj.getAsJsonObject("account")); + } + if (jsonObj.get("balances") != null && !jsonObj.get("balances").isJsonNull()) { + JsonArray jsonArraybalances = jsonObj.getAsJsonArray("balances"); + if (jsonArraybalances != null) { + // ensure the json data is an array + if (!jsonObj.get("balances").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `balances` to be an array in the JSON string but got `%s`", jsonObj.get("balances").toString())); + } + + // validate the optional field `balances` (array) + for (int i = 0; i < jsonArraybalances.size(); i++) { + Balance.validateJsonObject(jsonArraybalances.get(i).getAsJsonObject()); + }; + } + } + if (jsonObj.get("positions") != null && !jsonObj.get("positions").isJsonNull()) { + JsonArray jsonArraypositions = jsonObj.getAsJsonArray("positions"); + if (jsonArraypositions != null) { + // ensure the json data is an array + if (!jsonObj.get("positions").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `positions` to be an array in the JSON string but got `%s`", jsonObj.get("positions").toString())); + } + + // validate the optional field `positions` (array) + for (int i = 0; i < jsonArraypositions.size(); i++) { + Position.validateJsonObject(jsonArraypositions.get(i).getAsJsonObject()); + }; + } + } + if (jsonObj.get("option_positions") != null && !jsonObj.get("option_positions").isJsonNull()) { + JsonArray jsonArrayoptionPositions = jsonObj.getAsJsonArray("option_positions"); + if (jsonArrayoptionPositions != null) { + // ensure the json data is an array + if (!jsonObj.get("option_positions").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `option_positions` to be an array in the JSON string but got `%s`", jsonObj.get("option_positions").toString())); + } + + // validate the optional field `option_positions` (array) + for (int i = 0; i < jsonArrayoptionPositions.size(); i++) { + OptionsPosition.validateJsonObject(jsonArrayoptionPositions.get(i).getAsJsonObject()); + }; + } + } + if (jsonObj.get("orders") != null && !jsonObj.get("orders").isJsonNull()) { + JsonArray jsonArrayorders = jsonObj.getAsJsonArray("orders"); + if (jsonArrayorders != null) { + // ensure the json data is an array + if (!jsonObj.get("orders").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `orders` to be an array in the JSON string but got `%s`", jsonObj.get("orders").toString())); + } + + // validate the optional field `orders` (array) + for (int i = 0; i < jsonArrayorders.size(); i++) { + AccountOrderRecord.validateJsonObject(jsonArrayorders.get(i).getAsJsonObject()); + }; + } + } + // validate the optional field `total_value` + if (jsonObj.get("total_value") != null && !jsonObj.get("total_value").isJsonNull()) { + SnapTradeHoldingsTotalValue.validateJsonObject(jsonObj.getAsJsonObject("total_value")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AccountHoldingsAccount.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AccountHoldingsAccount' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AccountHoldingsAccount.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AccountHoldingsAccount value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AccountHoldingsAccount read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + AccountHoldingsAccount instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AccountHoldingsAccount given an JSON string + * + * @param jsonString JSON string + * @return An instance of AccountHoldingsAccount + * @throws IOException if the JSON string is invalid with respect to AccountHoldingsAccount + */ + public static AccountHoldingsAccount fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AccountHoldingsAccount.class); + } + + /** + * Convert an instance of AccountHoldingsAccount to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/AccountOrderRecord.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/AccountOrderRecord.java new file mode 100644 index 0000000000..12848f72db --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/AccountOrderRecord.java @@ -0,0 +1,1050 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.AccountOrderRecordStatus; +import com.konfigthis.client.model.OptionsSymbol; +import com.konfigthis.client.model.UniversalSymbol; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Record of order in brokerageaccount + */ +@ApiModel(description = "Record of order in brokerageaccount")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class AccountOrderRecord { + public static final String SERIALIZED_NAME_BROKERAGE_ORDER_ID = "brokerage_order_id"; + @SerializedName(SERIALIZED_NAME_BROKERAGE_ORDER_ID) + private String brokerageOrderId; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private AccountOrderRecordStatus status; + + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + @SerializedName(SERIALIZED_NAME_SYMBOL) + private UUID symbol; + + public static final String SERIALIZED_NAME_UNIVERSAL_SYMBOL = "universal_symbol"; + @SerializedName(SERIALIZED_NAME_UNIVERSAL_SYMBOL) + private UniversalSymbol universalSymbol; + + public static final String SERIALIZED_NAME_OPTION_SYMBOL = "option_symbol"; + @SerializedName(SERIALIZED_NAME_OPTION_SYMBOL) + private OptionsSymbol optionSymbol; + + public static final String SERIALIZED_NAME_ACTION = "action"; + @SerializedName(SERIALIZED_NAME_ACTION) + private String action; + + public static final String SERIALIZED_NAME_TOTAL_QUANTITY = "total_quantity"; + @SerializedName(SERIALIZED_NAME_TOTAL_QUANTITY) + private Double totalQuantity; + + public static final String SERIALIZED_NAME_OPEN_QUANTITY = "open_quantity"; + @SerializedName(SERIALIZED_NAME_OPEN_QUANTITY) + private Double openQuantity; + + public static final String SERIALIZED_NAME_CANCELED_QUANTITY = "canceled_quantity"; + @SerializedName(SERIALIZED_NAME_CANCELED_QUANTITY) + private Double canceledQuantity; + + public static final String SERIALIZED_NAME_FILLED_QUANTITY = "filled_quantity"; + @SerializedName(SERIALIZED_NAME_FILLED_QUANTITY) + private Double filledQuantity; + + public static final String SERIALIZED_NAME_EXECUTION_PRICE = "execution_price"; + @SerializedName(SERIALIZED_NAME_EXECUTION_PRICE) + private Double executionPrice; + + public static final String SERIALIZED_NAME_LIMIT_PRICE = "limit_price"; + @SerializedName(SERIALIZED_NAME_LIMIT_PRICE) + private Double limitPrice; + + public static final String SERIALIZED_NAME_STOP_PRICE = "stop_price"; + @SerializedName(SERIALIZED_NAME_STOP_PRICE) + private Double stopPrice; + + public static final String SERIALIZED_NAME_ORDER_TYPE = "order_type"; + @SerializedName(SERIALIZED_NAME_ORDER_TYPE) + private String orderType; + + public static final String SERIALIZED_NAME_TIME_IN_FORCE = "time_in_force"; + @SerializedName(SERIALIZED_NAME_TIME_IN_FORCE) + private String timeInForce; + + public static final String SERIALIZED_NAME_TIME_PLACED = "time_placed"; + @SerializedName(SERIALIZED_NAME_TIME_PLACED) + private String timePlaced; + + public static final String SERIALIZED_NAME_TIME_UPDATED = "time_updated"; + @SerializedName(SERIALIZED_NAME_TIME_UPDATED) + private String timeUpdated; + + public static final String SERIALIZED_NAME_TIME_EXECUTED = "time_executed"; + @SerializedName(SERIALIZED_NAME_TIME_EXECUTED) + private String timeExecuted; + + public static final String SERIALIZED_NAME_EXPIRY_DATE = "expiry_date"; + @SerializedName(SERIALIZED_NAME_EXPIRY_DATE) + private String expiryDate; + + public AccountOrderRecord() { + } + + public AccountOrderRecord brokerageOrderId(String brokerageOrderId) { + + + + + this.brokerageOrderId = brokerageOrderId; + return this; + } + + /** + * Order id returned by brokerage + * @return brokerageOrderId + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Order id returned by brokerage") + + public String getBrokerageOrderId() { + return brokerageOrderId; + } + + + public void setBrokerageOrderId(String brokerageOrderId) { + + + + this.brokerageOrderId = brokerageOrderId; + } + + + public AccountOrderRecord status(AccountOrderRecordStatus status) { + + + + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public AccountOrderRecordStatus getStatus() { + return status; + } + + + public void setStatus(AccountOrderRecordStatus status) { + + + + this.status = status; + } + + + public AccountOrderRecord symbol(UUID symbol) { + + + + + this.symbol = symbol; + return this; + } + + /** + * Get symbol + * @return symbol + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getSymbol() { + return symbol; + } + + + public void setSymbol(UUID symbol) { + + + + this.symbol = symbol; + } + + + public AccountOrderRecord universalSymbol(UniversalSymbol universalSymbol) { + + + + + this.universalSymbol = universalSymbol; + return this; + } + + /** + * Get universalSymbol + * @return universalSymbol + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public UniversalSymbol getUniversalSymbol() { + return universalSymbol; + } + + + public void setUniversalSymbol(UniversalSymbol universalSymbol) { + + + + this.universalSymbol = universalSymbol; + } + + + public AccountOrderRecord optionSymbol(OptionsSymbol optionSymbol) { + + + + + this.optionSymbol = optionSymbol; + return this; + } + + /** + * Get optionSymbol + * @return optionSymbol + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public OptionsSymbol getOptionSymbol() { + return optionSymbol; + } + + + public void setOptionSymbol(OptionsSymbol optionSymbol) { + + + + this.optionSymbol = optionSymbol; + } + + + public AccountOrderRecord action(String action) { + + + + + this.action = action; + return this; + } + + /** + * Trade Action potential values include (but are not limited to) - BUY - SELL - BUY_COVER - SELL_SHORT - BUY_OPEN - BUY_CLOSE - SELL_OPEN - SELL_CLOSE + * @return action + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Trade Action potential values include (but are not limited to) - BUY - SELL - BUY_COVER - SELL_SHORT - BUY_OPEN - BUY_CLOSE - SELL_OPEN - SELL_CLOSE") + + public String getAction() { + return action; + } + + + public void setAction(String action) { + + + + this.action = action; + } + + + public AccountOrderRecord totalQuantity(Double totalQuantity) { + + + + + this.totalQuantity = totalQuantity; + return this; + } + + public AccountOrderRecord totalQuantity(Integer totalQuantity) { + + + + + this.totalQuantity = totalQuantity.doubleValue(); + return this; + } + + /** + * Trade Units. Cannot work with notional value. + * @return totalQuantity + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Trade Units. Cannot work with notional value.") + + public Double getTotalQuantity() { + return totalQuantity; + } + + + public void setTotalQuantity(Double totalQuantity) { + + + + this.totalQuantity = totalQuantity; + } + + + public AccountOrderRecord openQuantity(Double openQuantity) { + + + + + this.openQuantity = openQuantity; + return this; + } + + public AccountOrderRecord openQuantity(Integer openQuantity) { + + + + + this.openQuantity = openQuantity.doubleValue(); + return this; + } + + /** + * Trade Units + * @return openQuantity + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Trade Units") + + public Double getOpenQuantity() { + return openQuantity; + } + + + public void setOpenQuantity(Double openQuantity) { + + + + this.openQuantity = openQuantity; + } + + + public AccountOrderRecord canceledQuantity(Double canceledQuantity) { + + + + + this.canceledQuantity = canceledQuantity; + return this; + } + + public AccountOrderRecord canceledQuantity(Integer canceledQuantity) { + + + + + this.canceledQuantity = canceledQuantity.doubleValue(); + return this; + } + + /** + * Trade Units + * @return canceledQuantity + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Trade Units") + + public Double getCanceledQuantity() { + return canceledQuantity; + } + + + public void setCanceledQuantity(Double canceledQuantity) { + + + + this.canceledQuantity = canceledQuantity; + } + + + public AccountOrderRecord filledQuantity(Double filledQuantity) { + + + + + this.filledQuantity = filledQuantity; + return this; + } + + public AccountOrderRecord filledQuantity(Integer filledQuantity) { + + + + + this.filledQuantity = filledQuantity.doubleValue(); + return this; + } + + /** + * Trade Units + * @return filledQuantity + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Trade Units") + + public Double getFilledQuantity() { + return filledQuantity; + } + + + public void setFilledQuantity(Double filledQuantity) { + + + + this.filledQuantity = filledQuantity; + } + + + public AccountOrderRecord executionPrice(Double executionPrice) { + + + + + this.executionPrice = executionPrice; + return this; + } + + public AccountOrderRecord executionPrice(Integer executionPrice) { + + + + + this.executionPrice = executionPrice.doubleValue(); + return this; + } + + /** + * Trade Price if limit or stop limit order + * @return executionPrice + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "31.33", value = "Trade Price if limit or stop limit order") + + public Double getExecutionPrice() { + return executionPrice; + } + + + public void setExecutionPrice(Double executionPrice) { + + + + this.executionPrice = executionPrice; + } + + + public AccountOrderRecord limitPrice(Double limitPrice) { + + + + + this.limitPrice = limitPrice; + return this; + } + + public AccountOrderRecord limitPrice(Integer limitPrice) { + + + + + this.limitPrice = limitPrice.doubleValue(); + return this; + } + + /** + * Trade Price if limit or stop limit order + * @return limitPrice + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "31.33", value = "Trade Price if limit or stop limit order") + + public Double getLimitPrice() { + return limitPrice; + } + + + public void setLimitPrice(Double limitPrice) { + + + + this.limitPrice = limitPrice; + } + + + public AccountOrderRecord stopPrice(Double stopPrice) { + + + + + this.stopPrice = stopPrice; + return this; + } + + public AccountOrderRecord stopPrice(Integer stopPrice) { + + + + + this.stopPrice = stopPrice.doubleValue(); + return this; + } + + /** + * Stop Price. If stop loss or stop limit order, the price to trigger the stop + * @return stopPrice + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "31.33", value = "Stop Price. If stop loss or stop limit order, the price to trigger the stop") + + public Double getStopPrice() { + return stopPrice; + } + + + public void setStopPrice(Double stopPrice) { + + + + this.stopPrice = stopPrice; + } + + + public AccountOrderRecord orderType(String orderType) { + + + + + this.orderType = orderType; + return this; + } + + /** + * Order Type potential values include (but are not limited to) - Limit - Market - StopLimit - StopLoss + * @return orderType + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Order Type potential values include (but are not limited to) - Limit - Market - StopLimit - StopLoss") + + public String getOrderType() { + return orderType; + } + + + public void setOrderType(String orderType) { + + + + this.orderType = orderType; + } + + + public AccountOrderRecord timeInForce(String timeInForce) { + + + + + this.timeInForce = timeInForce; + return this; + } + + /** + * Trade time in force examples: * FOK - Fill Or Kill * Day - Day * GTC - Good Til Canceled * GTD - Good Til Date + * @return timeInForce + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Trade time in force examples: * FOK - Fill Or Kill * Day - Day * GTC - Good Til Canceled * GTD - Good Til Date ") + + public String getTimeInForce() { + return timeInForce; + } + + + public void setTimeInForce(String timeInForce) { + + + + this.timeInForce = timeInForce; + } + + + public AccountOrderRecord timePlaced(String timePlaced) { + + + + + this.timePlaced = timePlaced; + return this; + } + + /** + * Time + * @return timePlaced + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2022-01-21T20:11:19.217Z", value = "Time") + + public String getTimePlaced() { + return timePlaced; + } + + + public void setTimePlaced(String timePlaced) { + + + + this.timePlaced = timePlaced; + } + + + public AccountOrderRecord timeUpdated(String timeUpdated) { + + + + + this.timeUpdated = timeUpdated; + return this; + } + + /** + * Time + * @return timeUpdated + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2022-01-21T20:11:19.217Z", value = "Time") + + public String getTimeUpdated() { + return timeUpdated; + } + + + public void setTimeUpdated(String timeUpdated) { + + + + this.timeUpdated = timeUpdated; + } + + + public AccountOrderRecord timeExecuted(String timeExecuted) { + + + + + this.timeExecuted = timeExecuted; + return this; + } + + /** + * Time + * @return timeExecuted + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2022-01-21T20:11:19.217Z", value = "Time") + + public String getTimeExecuted() { + return timeExecuted; + } + + + public void setTimeExecuted(String timeExecuted) { + + + + this.timeExecuted = timeExecuted; + } + + + public AccountOrderRecord expiryDate(String expiryDate) { + + + + + this.expiryDate = expiryDate; + return this; + } + + /** + * Time + * @return expiryDate + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2022-01-21T20:11:19.217Z", value = "Time") + + public String getExpiryDate() { + return expiryDate; + } + + + public void setExpiryDate(String expiryDate) { + + + + this.expiryDate = expiryDate; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AccountOrderRecord instance itself + */ + public AccountOrderRecord putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AccountOrderRecord accountOrderRecord = (AccountOrderRecord) o; + return Objects.equals(this.brokerageOrderId, accountOrderRecord.brokerageOrderId) && + Objects.equals(this.status, accountOrderRecord.status) && + Objects.equals(this.symbol, accountOrderRecord.symbol) && + Objects.equals(this.universalSymbol, accountOrderRecord.universalSymbol) && + Objects.equals(this.optionSymbol, accountOrderRecord.optionSymbol) && + Objects.equals(this.action, accountOrderRecord.action) && + Objects.equals(this.totalQuantity, accountOrderRecord.totalQuantity) && + Objects.equals(this.openQuantity, accountOrderRecord.openQuantity) && + Objects.equals(this.canceledQuantity, accountOrderRecord.canceledQuantity) && + Objects.equals(this.filledQuantity, accountOrderRecord.filledQuantity) && + Objects.equals(this.executionPrice, accountOrderRecord.executionPrice) && + Objects.equals(this.limitPrice, accountOrderRecord.limitPrice) && + Objects.equals(this.stopPrice, accountOrderRecord.stopPrice) && + Objects.equals(this.orderType, accountOrderRecord.orderType) && + Objects.equals(this.timeInForce, accountOrderRecord.timeInForce) && + Objects.equals(this.timePlaced, accountOrderRecord.timePlaced) && + Objects.equals(this.timeUpdated, accountOrderRecord.timeUpdated) && + Objects.equals(this.timeExecuted, accountOrderRecord.timeExecuted) && + Objects.equals(this.expiryDate, accountOrderRecord.expiryDate)&& + Objects.equals(this.additionalProperties, accountOrderRecord.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(brokerageOrderId, status, symbol, universalSymbol, optionSymbol, action, totalQuantity, openQuantity, canceledQuantity, filledQuantity, executionPrice, limitPrice, stopPrice, orderType, timeInForce, timePlaced, timeUpdated, timeExecuted, expiryDate, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AccountOrderRecord {\n"); + sb.append(" brokerageOrderId: ").append(toIndentedString(brokerageOrderId)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" universalSymbol: ").append(toIndentedString(universalSymbol)).append("\n"); + sb.append(" optionSymbol: ").append(toIndentedString(optionSymbol)).append("\n"); + sb.append(" action: ").append(toIndentedString(action)).append("\n"); + sb.append(" totalQuantity: ").append(toIndentedString(totalQuantity)).append("\n"); + sb.append(" openQuantity: ").append(toIndentedString(openQuantity)).append("\n"); + sb.append(" canceledQuantity: ").append(toIndentedString(canceledQuantity)).append("\n"); + sb.append(" filledQuantity: ").append(toIndentedString(filledQuantity)).append("\n"); + sb.append(" executionPrice: ").append(toIndentedString(executionPrice)).append("\n"); + sb.append(" limitPrice: ").append(toIndentedString(limitPrice)).append("\n"); + sb.append(" stopPrice: ").append(toIndentedString(stopPrice)).append("\n"); + sb.append(" orderType: ").append(toIndentedString(orderType)).append("\n"); + sb.append(" timeInForce: ").append(toIndentedString(timeInForce)).append("\n"); + sb.append(" timePlaced: ").append(toIndentedString(timePlaced)).append("\n"); + sb.append(" timeUpdated: ").append(toIndentedString(timeUpdated)).append("\n"); + sb.append(" timeExecuted: ").append(toIndentedString(timeExecuted)).append("\n"); + sb.append(" expiryDate: ").append(toIndentedString(expiryDate)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("brokerage_order_id"); + openapiFields.add("status"); + openapiFields.add("symbol"); + openapiFields.add("universal_symbol"); + openapiFields.add("option_symbol"); + openapiFields.add("action"); + openapiFields.add("total_quantity"); + openapiFields.add("open_quantity"); + openapiFields.add("canceled_quantity"); + openapiFields.add("filled_quantity"); + openapiFields.add("execution_price"); + openapiFields.add("limit_price"); + openapiFields.add("stop_price"); + openapiFields.add("order_type"); + openapiFields.add("time_in_force"); + openapiFields.add("time_placed"); + openapiFields.add("time_updated"); + openapiFields.add("time_executed"); + openapiFields.add("expiry_date"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to AccountOrderRecord + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!AccountOrderRecord.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AccountOrderRecord is not found in the empty JSON string", AccountOrderRecord.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("brokerage_order_id") != null && !jsonObj.get("brokerage_order_id").isJsonNull()) && !jsonObj.get("brokerage_order_id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `brokerage_order_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("brokerage_order_id").toString())); + } + if ((jsonObj.get("symbol") != null && !jsonObj.get("symbol").isJsonNull()) && !jsonObj.get("symbol").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `symbol` to be a primitive type in the JSON string but got `%s`", jsonObj.get("symbol").toString())); + } + // validate the optional field `universal_symbol` + if (jsonObj.get("universal_symbol") != null && !jsonObj.get("universal_symbol").isJsonNull()) { + UniversalSymbol.validateJsonObject(jsonObj.getAsJsonObject("universal_symbol")); + } + // validate the optional field `option_symbol` + if (jsonObj.get("option_symbol") != null && !jsonObj.get("option_symbol").isJsonNull()) { + OptionsSymbol.validateJsonObject(jsonObj.getAsJsonObject("option_symbol")); + } + if ((jsonObj.get("action") != null && !jsonObj.get("action").isJsonNull()) && !jsonObj.get("action").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `action` to be a primitive type in the JSON string but got `%s`", jsonObj.get("action").toString())); + } + if (!jsonObj.get("order_type").isJsonNull() && (jsonObj.get("order_type") != null && !jsonObj.get("order_type").isJsonNull()) && !jsonObj.get("order_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `order_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("order_type").toString())); + } + if ((jsonObj.get("time_in_force") != null && !jsonObj.get("time_in_force").isJsonNull()) && !jsonObj.get("time_in_force").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `time_in_force` to be a primitive type in the JSON string but got `%s`", jsonObj.get("time_in_force").toString())); + } + if ((jsonObj.get("time_placed") != null && !jsonObj.get("time_placed").isJsonNull()) && !jsonObj.get("time_placed").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `time_placed` to be a primitive type in the JSON string but got `%s`", jsonObj.get("time_placed").toString())); + } + if (!jsonObj.get("time_updated").isJsonNull() && (jsonObj.get("time_updated") != null && !jsonObj.get("time_updated").isJsonNull()) && !jsonObj.get("time_updated").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `time_updated` to be a primitive type in the JSON string but got `%s`", jsonObj.get("time_updated").toString())); + } + if (!jsonObj.get("time_executed").isJsonNull() && (jsonObj.get("time_executed") != null && !jsonObj.get("time_executed").isJsonNull()) && !jsonObj.get("time_executed").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `time_executed` to be a primitive type in the JSON string but got `%s`", jsonObj.get("time_executed").toString())); + } + if ((jsonObj.get("expiry_date") != null && !jsonObj.get("expiry_date").isJsonNull()) && !jsonObj.get("expiry_date").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `expiry_date` to be a primitive type in the JSON string but got `%s`", jsonObj.get("expiry_date").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AccountOrderRecord.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AccountOrderRecord' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AccountOrderRecord.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AccountOrderRecord value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AccountOrderRecord read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + AccountOrderRecord instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AccountOrderRecord given an JSON string + * + * @param jsonString JSON string + * @return An instance of AccountOrderRecord + * @throws IOException if the JSON string is invalid with respect to AccountOrderRecord + */ + public static AccountOrderRecord fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AccountOrderRecord.class); + } + + /** + * Convert an instance of AccountOrderRecord to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/AccountOrderRecordStatus.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/AccountOrderRecordStatus.java new file mode 100644 index 0000000000..25609ac87e --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/AccountOrderRecordStatus.java @@ -0,0 +1,107 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets AccountOrderRecordStatus + */ +@JsonAdapter(AccountOrderRecordStatus.Adapter.class)public enum AccountOrderRecordStatus { + + NONE("NONE"), + + PENDING("PENDING"), + + ACCEPTED("ACCEPTED"), + + FAILED("FAILED"), + + REJECTED("REJECTED"), + + CANCELED("CANCELED"), + + PARTIAL_CANCELED("PARTIAL_CANCELED"), + + CANCEL_PENDING("CANCEL_PENDING"), + + EXECUTED("EXECUTED"), + + PARTIAL("PARTIAL"), + + REPLACE_PENDING("REPLACE_PENDING"), + + REPLACED("REPLACED"), + + STOPPED("STOPPED"), + + SUSPENDED("SUSPENDED"), + + EXPIRED("EXPIRED"), + + QUEUED("QUEUED"), + + TRIGGERED("TRIGGERED"), + + ACTIVATED("ACTIVATED"), + + PENDING_RISK_REVIEW("PENDING_RISK_REVIEW"), + + CONTINGENT_ORDER("CONTINGENT_ORDER"); + + private String value; + + AccountOrderRecordStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AccountOrderRecordStatus fromValue(String value) { + for (AccountOrderRecordStatus b : AccountOrderRecordStatus.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final AccountOrderRecordStatus enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AccountOrderRecordStatus read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AccountOrderRecordStatus.fromValue(value); + } + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/AccountSimple.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/AccountSimple.java new file mode 100644 index 0000000000..0429f5b10d --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/AccountSimple.java @@ -0,0 +1,411 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.AccountSyncStatus; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * SnapTradeUser Investment Account + */ +@ApiModel(description = "SnapTradeUser Investment Account")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class AccountSimple { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private UUID id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_NUMBER = "number"; + @SerializedName(SERIALIZED_NAME_NUMBER) + private String number; + + public static final String SERIALIZED_NAME_SYNC_STATUS = "sync_status"; + @SerializedName(SERIALIZED_NAME_SYNC_STATUS) + private AccountSyncStatus syncStatus; + + public AccountSimple() { + } + + public AccountSimple id(UUID id) { + + + + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getId() { + return id; + } + + + public void setId(UUID id) { + + + + this.id = id; + } + + + public AccountSimple name(String name) { + + + + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Registered Retirement Savings Account", value = "") + + public String getName() { + return name; + } + + + public void setName(String name) { + + + + this.name = name; + } + + + public AccountSimple number(String number) { + + + + + this.number = number; + return this; + } + + /** + * Get number + * @return number + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Q6542138443", value = "") + + public String getNumber() { + return number; + } + + + public void setNumber(String number) { + + + + this.number = number; + } + + + public AccountSimple syncStatus(AccountSyncStatus syncStatus) { + + + + + this.syncStatus = syncStatus; + return this; + } + + /** + * Get syncStatus + * @return syncStatus + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public AccountSyncStatus getSyncStatus() { + return syncStatus; + } + + + public void setSyncStatus(AccountSyncStatus syncStatus) { + + + + this.syncStatus = syncStatus; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AccountSimple instance itself + */ + public AccountSimple putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AccountSimple accountSimple = (AccountSimple) o; + return Objects.equals(this.id, accountSimple.id) && + Objects.equals(this.name, accountSimple.name) && + Objects.equals(this.number, accountSimple.number) && + Objects.equals(this.syncStatus, accountSimple.syncStatus)&& + Objects.equals(this.additionalProperties, accountSimple.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, number, syncStatus, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AccountSimple {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" number: ").append(toIndentedString(number)).append("\n"); + sb.append(" syncStatus: ").append(toIndentedString(syncStatus)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("number"); + openapiFields.add("sync_status"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to AccountSimple + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!AccountSimple.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AccountSimple is not found in the empty JSON string", AccountSimple.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("number") != null && !jsonObj.get("number").isJsonNull()) && !jsonObj.get("number").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `number` to be a primitive type in the JSON string but got `%s`", jsonObj.get("number").toString())); + } + // validate the optional field `sync_status` + if (jsonObj.get("sync_status") != null && !jsonObj.get("sync_status").isJsonNull()) { + AccountSyncStatus.validateJsonObject(jsonObj.getAsJsonObject("sync_status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AccountSimple.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AccountSimple' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AccountSimple.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AccountSimple value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AccountSimple read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + AccountSimple instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AccountSimple given an JSON string + * + * @param jsonString JSON string + * @return An instance of AccountSimple + * @throws IOException if the JSON string is invalid with respect to AccountSimple + */ + public static AccountSimple fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AccountSimple.class); + } + + /** + * Convert an instance of AccountSimple to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/AccountSyncStatus.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/AccountSyncStatus.java new file mode 100644 index 0000000000..227528e3b4 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/AccountSyncStatus.java @@ -0,0 +1,334 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.HoldingsStatus; +import com.konfigthis.client.model.TransactionsStatus; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Status of account + */ +@ApiModel(description = "Status of account")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class AccountSyncStatus { + public static final String SERIALIZED_NAME_TRANSACTIONS = "transactions"; + @SerializedName(SERIALIZED_NAME_TRANSACTIONS) + private TransactionsStatus transactions; + + public static final String SERIALIZED_NAME_HOLDINGS = "holdings"; + @SerializedName(SERIALIZED_NAME_HOLDINGS) + private HoldingsStatus holdings; + + public AccountSyncStatus() { + } + + public AccountSyncStatus transactions(TransactionsStatus transactions) { + + + + + this.transactions = transactions; + return this; + } + + /** + * Get transactions + * @return transactions + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public TransactionsStatus getTransactions() { + return transactions; + } + + + public void setTransactions(TransactionsStatus transactions) { + + + + this.transactions = transactions; + } + + + public AccountSyncStatus holdings(HoldingsStatus holdings) { + + + + + this.holdings = holdings; + return this; + } + + /** + * Get holdings + * @return holdings + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public HoldingsStatus getHoldings() { + return holdings; + } + + + public void setHoldings(HoldingsStatus holdings) { + + + + this.holdings = holdings; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AccountSyncStatus instance itself + */ + public AccountSyncStatus putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AccountSyncStatus accountSyncStatus = (AccountSyncStatus) o; + return Objects.equals(this.transactions, accountSyncStatus.transactions) && + Objects.equals(this.holdings, accountSyncStatus.holdings)&& + Objects.equals(this.additionalProperties, accountSyncStatus.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(transactions, holdings, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AccountSyncStatus {\n"); + sb.append(" transactions: ").append(toIndentedString(transactions)).append("\n"); + sb.append(" holdings: ").append(toIndentedString(holdings)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("transactions"); + openapiFields.add("holdings"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to AccountSyncStatus + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!AccountSyncStatus.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AccountSyncStatus is not found in the empty JSON string", AccountSyncStatus.openapiRequiredFields.toString())); + } + } + // validate the optional field `transactions` + if (jsonObj.get("transactions") != null && !jsonObj.get("transactions").isJsonNull()) { + TransactionsStatus.validateJsonObject(jsonObj.getAsJsonObject("transactions")); + } + // validate the optional field `holdings` + if (jsonObj.get("holdings") != null && !jsonObj.get("holdings").isJsonNull()) { + HoldingsStatus.validateJsonObject(jsonObj.getAsJsonObject("holdings")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AccountSyncStatus.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AccountSyncStatus' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AccountSyncStatus.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AccountSyncStatus value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AccountSyncStatus read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + AccountSyncStatus instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AccountSyncStatus given an JSON string + * + * @param jsonString JSON string + * @return An instance of AccountSyncStatus + * @throws IOException if the JSON string is invalid with respect to AccountSyncStatus + */ + public static AccountSyncStatus fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AccountSyncStatus.class); + } + + /** + * Convert an instance of AccountSyncStatus to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ActionStrict.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ActionStrict.java new file mode 100644 index 0000000000..2d80b4748c --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ActionStrict.java @@ -0,0 +1,72 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Trade Action + */ +@JsonAdapter(ActionStrict.Adapter.class)public enum ActionStrict { + + BUY("BUY"), + + SELL("SELL"); + + private String value; + + ActionStrict(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ActionStrict fromValue(String value) { + for (ActionStrict b : ActionStrict.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ActionStrict enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ActionStrict read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ActionStrict.fromValue(value); + } + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/Amount.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/Amount.java new file mode 100644 index 0000000000..a83d85ef88 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/Amount.java @@ -0,0 +1,336 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Total value of the account, as reported by the brokerage + */ +@ApiModel(description = "Total value of the account, as reported by the brokerage")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class Amount { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Double amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + private String currency; + + public Amount() { + } + + public Amount amount(Double amount) { + + + + + this.amount = amount; + return this; + } + + public Amount amount(Integer amount) { + + + + + this.amount = amount.doubleValue(); + return this; + } + + /** + * Total value denominated in the currency of the `currency` field. + * @return amount + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "15363.23", value = "Total value denominated in the currency of the `currency` field.") + + public Double getAmount() { + return amount; + } + + + public void setAmount(Double amount) { + + + + this.amount = amount; + } + + + public Amount currency(String currency) { + + + + + this.currency = currency; + return this; + } + + /** + * The ISO-4217 currency code for the amount. + * @return currency + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "USD", value = "The ISO-4217 currency code for the amount.") + + public String getCurrency() { + return currency; + } + + + public void setCurrency(String currency) { + + + + this.currency = currency; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Amount instance itself + */ + public Amount putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Amount amount = (Amount) o; + return Objects.equals(this.amount, amount.amount) && + Objects.equals(this.currency, amount.currency)&& + Objects.equals(this.additionalProperties, amount.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Amount {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to Amount + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!Amount.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Amount is not found in the empty JSON string", Amount.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) && !jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Amount.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Amount' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Amount.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Amount value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Amount read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + Amount instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Amount given an JSON string + * + * @param jsonString JSON string + * @return An instance of Amount + * @throws IOException if the JSON string is invalid with respect to Amount + */ + public static Amount fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Amount.class); + } + + /** + * Convert an instance of Amount to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/AmountNullable.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/AmountNullable.java new file mode 100644 index 0000000000..c6c13a02f4 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/AmountNullable.java @@ -0,0 +1,336 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Total value of the account, as reported by the brokerage + */ +@ApiModel(description = "Total value of the account, as reported by the brokerage")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class AmountNullable { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Double amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + private String currency; + + public AmountNullable() { + } + + public AmountNullable amount(Double amount) { + + + + + this.amount = amount; + return this; + } + + public AmountNullable amount(Integer amount) { + + + + + this.amount = amount.doubleValue(); + return this; + } + + /** + * Total value denominated in the currency of the `currency` field. + * @return amount + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "15363.23", value = "Total value denominated in the currency of the `currency` field.") + + public Double getAmount() { + return amount; + } + + + public void setAmount(Double amount) { + + + + this.amount = amount; + } + + + public AmountNullable currency(String currency) { + + + + + this.currency = currency; + return this; + } + + /** + * The ISO-4217 currency code for the amount. + * @return currency + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "USD", value = "The ISO-4217 currency code for the amount.") + + public String getCurrency() { + return currency; + } + + + public void setCurrency(String currency) { + + + + this.currency = currency; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AmountNullable instance itself + */ + public AmountNullable putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AmountNullable amountNullable = (AmountNullable) o; + return Objects.equals(this.amount, amountNullable.amount) && + Objects.equals(this.currency, amountNullable.currency)&& + Objects.equals(this.additionalProperties, amountNullable.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AmountNullable {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to AmountNullable + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!AmountNullable.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AmountNullable is not found in the empty JSON string", AmountNullable.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) && !jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AmountNullable.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AmountNullable' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AmountNullable.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AmountNullable value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AmountNullable read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + AmountNullable instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AmountNullable given an JSON string + * + * @param jsonString JSON string + * @return An instance of AmountNullable + * @throws IOException if the JSON string is invalid with respect to AmountNullable + */ + public static AmountNullable fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AmountNullable.class); + } + + /** + * Convert an instance of AmountNullable to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/Balance.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/Balance.java new file mode 100644 index 0000000000..d24c988b28 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/Balance.java @@ -0,0 +1,395 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.Currency; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Holds balance information for a single currency in an account. + */ +@ApiModel(description = "Holds balance information for a single currency in an account.")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class Balance { + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + private Currency currency; + + public static final String SERIALIZED_NAME_CASH = "cash"; + @SerializedName(SERIALIZED_NAME_CASH) + private Double cash; + + public static final String SERIALIZED_NAME_BUYING_POWER = "buying_power"; + @SerializedName(SERIALIZED_NAME_BUYING_POWER) + private Double buyingPower; + + public Balance() { + } + + public Balance currency(Currency currency) { + + + + + this.currency = currency; + return this; + } + + /** + * Get currency + * @return currency + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Currency getCurrency() { + return currency; + } + + + public void setCurrency(Currency currency) { + + + + this.currency = currency; + } + + + public Balance cash(Double cash) { + + + + + this.cash = cash; + return this; + } + + public Balance cash(Integer cash) { + + + + + this.cash = cash.doubleValue(); + return this; + } + + /** + * The amount of available cash in the account denominated in the currency of the `currency` field. + * @return cash + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "300.71", value = "The amount of available cash in the account denominated in the currency of the `currency` field.") + + public Double getCash() { + return cash; + } + + + public void setCash(Double cash) { + + + + this.cash = cash; + } + + + public Balance buyingPower(Double buyingPower) { + + + + + this.buyingPower = buyingPower; + return this; + } + + public Balance buyingPower(Integer buyingPower) { + + + + + this.buyingPower = buyingPower.doubleValue(); + return this; + } + + /** + * Buying power only applies to margin accounts. For non-margin accounts, buying power should be the same as cash. Please note that this field is not always available for all brokerages. + * @return buyingPower + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "410.71", value = "Buying power only applies to margin accounts. For non-margin accounts, buying power should be the same as cash. Please note that this field is not always available for all brokerages.") + + public Double getBuyingPower() { + return buyingPower; + } + + + public void setBuyingPower(Double buyingPower) { + + + + this.buyingPower = buyingPower; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Balance instance itself + */ + public Balance putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Balance balance = (Balance) o; + return Objects.equals(this.currency, balance.currency) && + Objects.equals(this.cash, balance.cash) && + Objects.equals(this.buyingPower, balance.buyingPower)&& + Objects.equals(this.additionalProperties, balance.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(currency, cash, buyingPower, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Balance {\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append(" cash: ").append(toIndentedString(cash)).append("\n"); + sb.append(" buyingPower: ").append(toIndentedString(buyingPower)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("currency"); + openapiFields.add("cash"); + openapiFields.add("buying_power"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to Balance + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!Balance.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Balance is not found in the empty JSON string", Balance.openapiRequiredFields.toString())); + } + } + // validate the optional field `currency` + if (jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) { + Currency.validateJsonObject(jsonObj.getAsJsonObject("currency")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Balance.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Balance' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Balance.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Balance value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Balance read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + Balance instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Balance given an JSON string + * + * @param jsonString JSON string + * @return An instance of Balance + * @throws IOException if the JSON string is invalid with respect to Balance + */ + public static Balance fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Balance.class); + } + + /** + * Convert an instance of Balance to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/Brokerage.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/Brokerage.java new file mode 100644 index 0000000000..cefaf91ff6 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/Brokerage.java @@ -0,0 +1,1033 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.BrokerageType; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Brokerage + */@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class Brokerage { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private UUID id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_DISPLAY_NAME = "display_name"; + @SerializedName(SERIALIZED_NAME_DISPLAY_NAME) + private String displayName; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_AWS_S3_LOGO_URL = "aws_s3_logo_url"; + @SerializedName(SERIALIZED_NAME_AWS_S3_LOGO_URL) + private String awsS3LogoUrl; + + public static final String SERIALIZED_NAME_AWS_S3_SQUARE_LOGO_URL = "aws_s3_square_logo_url"; + @SerializedName(SERIALIZED_NAME_AWS_S3_SQUARE_LOGO_URL) + private String awsS3SquareLogoUrl; + + public static final String SERIALIZED_NAME_OPEN_URL = "open_url"; + @SerializedName(SERIALIZED_NAME_OPEN_URL) + private String openUrl; + + public static final String SERIALIZED_NAME_SLUG = "slug"; + @SerializedName(SERIALIZED_NAME_SLUG) + private String slug; + + public static final String SERIALIZED_NAME_URL = "url"; + @SerializedName(SERIALIZED_NAME_URL) + private String url; + + public static final String SERIALIZED_NAME_ENABLED = "enabled"; + @SerializedName(SERIALIZED_NAME_ENABLED) + private Boolean enabled; + + public static final String SERIALIZED_NAME_MAINTENANCE_MODE = "maintenance_mode"; + @SerializedName(SERIALIZED_NAME_MAINTENANCE_MODE) + private Boolean maintenanceMode; + + public static final String SERIALIZED_NAME_ALLOWS_FRACTIONAL_UNITS = "allows_fractional_units"; + @SerializedName(SERIALIZED_NAME_ALLOWS_FRACTIONAL_UNITS) + private Boolean allowsFractionalUnits; + + public static final String SERIALIZED_NAME_ALLOWS_TRADING = "allows_trading"; + @SerializedName(SERIALIZED_NAME_ALLOWS_TRADING) + private Boolean allowsTrading; + + public static final String SERIALIZED_NAME_HAS_REPORTING = "has_reporting"; + @SerializedName(SERIALIZED_NAME_HAS_REPORTING) + private Boolean hasReporting; + + public static final String SERIALIZED_NAME_IS_REAL_TIME_CONNECTION = "is_real_time_connection"; + @SerializedName(SERIALIZED_NAME_IS_REAL_TIME_CONNECTION) + private Boolean isRealTimeConnection; + + public static final String SERIALIZED_NAME_ALLOWS_TRADING_THROUGH_SNAPTRADE_API = "allows_trading_through_snaptrade_api"; + @SerializedName(SERIALIZED_NAME_ALLOWS_TRADING_THROUGH_SNAPTRADE_API) + private Boolean allowsTradingThroughSnaptradeApi; + + public static final String SERIALIZED_NAME_IS_SCRAPING_INTEGRATION = "is_scraping_integration"; + @SerializedName(SERIALIZED_NAME_IS_SCRAPING_INTEGRATION) + private Boolean isScrapingIntegration; + + public static final String SERIALIZED_NAME_DEFAULT_CURRENCY = "default_currency"; + @SerializedName(SERIALIZED_NAME_DEFAULT_CURRENCY) + private UUID defaultCurrency; + + public static final String SERIALIZED_NAME_BROKERAGE_TYPE = "brokerage_type"; + @SerializedName(SERIALIZED_NAME_BROKERAGE_TYPE) + private BrokerageType brokerageType; + + public static final String SERIALIZED_NAME_EXCHANGES = "exchanges"; + @SerializedName(SERIALIZED_NAME_EXCHANGES) + private List exchanges = null; + + public Brokerage() { + } + + public Brokerage id(UUID id) { + + + + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getId() { + return id; + } + + + public void setId(UUID id) { + + + + this.id = id; + } + + + public Brokerage name(String name) { + + + + + this.name = name; + return this; + } + + /** + * Full name of the brokerage. + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Questrade", value = "Full name of the brokerage.") + + public String getName() { + return name; + } + + + public void setName(String name) { + + + + this.name = name; + } + + + public Brokerage displayName(String displayName) { + + + + + this.displayName = displayName; + return this; + } + + /** + * A display-friendly name of the brokerage. + * @return displayName + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Questrade", value = "A display-friendly name of the brokerage.") + + public String getDisplayName() { + return displayName; + } + + + public void setDisplayName(String displayName) { + + + + this.displayName = displayName; + } + + + public Brokerage description(String description) { + + + + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Questrade is an online brokerage firm and wealth management firm based in Canada. It is Canada's largest discount broker.", value = "") + + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + + + + this.description = description; + } + + + public Brokerage awsS3LogoUrl(String awsS3LogoUrl) { + + + + + this.awsS3LogoUrl = awsS3LogoUrl; + return this; + } + + /** + * Get awsS3LogoUrl + * @return awsS3LogoUrl + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "https://www.snaptrade.com/questrade.logo", value = "") + + public String getAwsS3LogoUrl() { + return awsS3LogoUrl; + } + + + public void setAwsS3LogoUrl(String awsS3LogoUrl) { + + + + this.awsS3LogoUrl = awsS3LogoUrl; + } + + + public Brokerage awsS3SquareLogoUrl(String awsS3SquareLogoUrl) { + + + + + this.awsS3SquareLogoUrl = awsS3SquareLogoUrl; + return this; + } + + /** + * Get awsS3SquareLogoUrl + * @return awsS3SquareLogoUrl + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "https://www.snaptrade.com/questrade.logo", value = "") + + public String getAwsS3SquareLogoUrl() { + return awsS3SquareLogoUrl; + } + + + public void setAwsS3SquareLogoUrl(String awsS3SquareLogoUrl) { + + + + this.awsS3SquareLogoUrl = awsS3SquareLogoUrl; + } + + + public Brokerage openUrl(String openUrl) { + + + + + this.openUrl = openUrl; + return this; + } + + /** + * Get openUrl + * @return openUrl + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "https://www.brokerage.com", value = "") + + public String getOpenUrl() { + return openUrl; + } + + + public void setOpenUrl(String openUrl) { + + + + this.openUrl = openUrl; + } + + + public Brokerage slug(String slug) { + + + + + this.slug = slug; + return this; + } + + /** + * A unique identifier for that brokerage. It is usually the name of the brokerage in capital letters and will never change. + * @return slug + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "QUESTRADE", value = "A unique identifier for that brokerage. It is usually the name of the brokerage in capital letters and will never change.") + + public String getSlug() { + return slug; + } + + + public void setSlug(String slug) { + + + + this.slug = slug; + } + + + public Brokerage url(String url) { + + + + + this.url = url; + return this; + } + + /** + * Get url + * @return url + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "https://www.questrade.com/", value = "") + + public String getUrl() { + return url; + } + + + public void setUrl(String url) { + + + + this.url = url; + } + + + public Brokerage enabled(Boolean enabled) { + + + + + this.enabled = enabled; + return this; + } + + /** + * Get enabled + * @return enabled + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "true", value = "") + + public Boolean getEnabled() { + return enabled; + } + + + public void setEnabled(Boolean enabled) { + + + + this.enabled = enabled; + } + + + public Brokerage maintenanceMode(Boolean maintenanceMode) { + + + + + this.maintenanceMode = maintenanceMode; + return this; + } + + /** + * Get maintenanceMode + * @return maintenanceMode + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "true", value = "") + + public Boolean getMaintenanceMode() { + return maintenanceMode; + } + + + public void setMaintenanceMode(Boolean maintenanceMode) { + + + + this.maintenanceMode = maintenanceMode; + } + + + public Brokerage allowsFractionalUnits(Boolean allowsFractionalUnits) { + + + + + this.allowsFractionalUnits = allowsFractionalUnits; + return this; + } + + /** + * Get allowsFractionalUnits + * @return allowsFractionalUnits + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "true", value = "") + + public Boolean getAllowsFractionalUnits() { + return allowsFractionalUnits; + } + + + public void setAllowsFractionalUnits(Boolean allowsFractionalUnits) { + + + + this.allowsFractionalUnits = allowsFractionalUnits; + } + + + public Brokerage allowsTrading(Boolean allowsTrading) { + + + + + this.allowsTrading = allowsTrading; + return this; + } + + /** + * Get allowsTrading + * @return allowsTrading + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "true", value = "") + + public Boolean getAllowsTrading() { + return allowsTrading; + } + + + public void setAllowsTrading(Boolean allowsTrading) { + + + + this.allowsTrading = allowsTrading; + } + + + public Brokerage hasReporting(Boolean hasReporting) { + + + + + this.hasReporting = hasReporting; + return this; + } + + /** + * Get hasReporting + * @return hasReporting + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "true", value = "") + + public Boolean getHasReporting() { + return hasReporting; + } + + + public void setHasReporting(Boolean hasReporting) { + + + + this.hasReporting = hasReporting; + } + + + public Brokerage isRealTimeConnection(Boolean isRealTimeConnection) { + + + + + this.isRealTimeConnection = isRealTimeConnection; + return this; + } + + /** + * Get isRealTimeConnection + * @return isRealTimeConnection + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "true", value = "") + + public Boolean getIsRealTimeConnection() { + return isRealTimeConnection; + } + + + public void setIsRealTimeConnection(Boolean isRealTimeConnection) { + + + + this.isRealTimeConnection = isRealTimeConnection; + } + + + public Brokerage allowsTradingThroughSnaptradeApi(Boolean allowsTradingThroughSnaptradeApi) { + + + + + this.allowsTradingThroughSnaptradeApi = allowsTradingThroughSnaptradeApi; + return this; + } + + /** + * Get allowsTradingThroughSnaptradeApi + * @return allowsTradingThroughSnaptradeApi + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "true", value = "") + + public Boolean getAllowsTradingThroughSnaptradeApi() { + return allowsTradingThroughSnaptradeApi; + } + + + public void setAllowsTradingThroughSnaptradeApi(Boolean allowsTradingThroughSnaptradeApi) { + + + + this.allowsTradingThroughSnaptradeApi = allowsTradingThroughSnaptradeApi; + } + + + public Brokerage isScrapingIntegration(Boolean isScrapingIntegration) { + + + + + this.isScrapingIntegration = isScrapingIntegration; + return this; + } + + /** + * Get isScrapingIntegration + * @return isScrapingIntegration + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "true", value = "") + + public Boolean getIsScrapingIntegration() { + return isScrapingIntegration; + } + + + public void setIsScrapingIntegration(Boolean isScrapingIntegration) { + + + + this.isScrapingIntegration = isScrapingIntegration; + } + + + public Brokerage defaultCurrency(UUID defaultCurrency) { + + + + + this.defaultCurrency = defaultCurrency; + return this; + } + + /** + * Get defaultCurrency + * @return defaultCurrency + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getDefaultCurrency() { + return defaultCurrency; + } + + + public void setDefaultCurrency(UUID defaultCurrency) { + + + + this.defaultCurrency = defaultCurrency; + } + + + public Brokerage brokerageType(BrokerageType brokerageType) { + + + + + this.brokerageType = brokerageType; + return this; + } + + /** + * Get brokerageType + * @return brokerageType + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public BrokerageType getBrokerageType() { + return brokerageType; + } + + + public void setBrokerageType(BrokerageType brokerageType) { + + + + this.brokerageType = brokerageType; + } + + + public Brokerage exchanges(List exchanges) { + + + + + this.exchanges = exchanges; + return this; + } + + public Brokerage addExchangesItem(Object exchangesItem) { + if (this.exchanges == null) { + this.exchanges = new ArrayList<>(); + } + this.exchanges.add(exchangesItem); + return this; + } + + /** + * List of exchange ID supported by brokerage + * @return exchanges + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "[\"2bcd7cc3-e922-4976-bce1-9858296801c3\",\"4bcd8cc3-c122-4974-dc21-1858296801f4\"]", value = "List of exchange ID supported by brokerage") + + public List getExchanges() { + return exchanges; + } + + + public void setExchanges(List exchanges) { + + + + this.exchanges = exchanges; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Brokerage instance itself + */ + public Brokerage putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Brokerage brokerage = (Brokerage) o; + return Objects.equals(this.id, brokerage.id) && + Objects.equals(this.name, brokerage.name) && + Objects.equals(this.displayName, brokerage.displayName) && + Objects.equals(this.description, brokerage.description) && + Objects.equals(this.awsS3LogoUrl, brokerage.awsS3LogoUrl) && + Objects.equals(this.awsS3SquareLogoUrl, brokerage.awsS3SquareLogoUrl) && + Objects.equals(this.openUrl, brokerage.openUrl) && + Objects.equals(this.slug, brokerage.slug) && + Objects.equals(this.url, brokerage.url) && + Objects.equals(this.enabled, brokerage.enabled) && + Objects.equals(this.maintenanceMode, brokerage.maintenanceMode) && + Objects.equals(this.allowsFractionalUnits, brokerage.allowsFractionalUnits) && + Objects.equals(this.allowsTrading, brokerage.allowsTrading) && + Objects.equals(this.hasReporting, brokerage.hasReporting) && + Objects.equals(this.isRealTimeConnection, brokerage.isRealTimeConnection) && + Objects.equals(this.allowsTradingThroughSnaptradeApi, brokerage.allowsTradingThroughSnaptradeApi) && + Objects.equals(this.isScrapingIntegration, brokerage.isScrapingIntegration) && + Objects.equals(this.defaultCurrency, brokerage.defaultCurrency) && + Objects.equals(this.brokerageType, brokerage.brokerageType) && + Objects.equals(this.exchanges, brokerage.exchanges)&& + Objects.equals(this.additionalProperties, brokerage.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, displayName, description, awsS3LogoUrl, awsS3SquareLogoUrl, openUrl, slug, url, enabled, maintenanceMode, allowsFractionalUnits, allowsTrading, hasReporting, isRealTimeConnection, allowsTradingThroughSnaptradeApi, isScrapingIntegration, defaultCurrency, brokerageType, exchanges, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Brokerage {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" awsS3LogoUrl: ").append(toIndentedString(awsS3LogoUrl)).append("\n"); + sb.append(" awsS3SquareLogoUrl: ").append(toIndentedString(awsS3SquareLogoUrl)).append("\n"); + sb.append(" openUrl: ").append(toIndentedString(openUrl)).append("\n"); + sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" maintenanceMode: ").append(toIndentedString(maintenanceMode)).append("\n"); + sb.append(" allowsFractionalUnits: ").append(toIndentedString(allowsFractionalUnits)).append("\n"); + sb.append(" allowsTrading: ").append(toIndentedString(allowsTrading)).append("\n"); + sb.append(" hasReporting: ").append(toIndentedString(hasReporting)).append("\n"); + sb.append(" isRealTimeConnection: ").append(toIndentedString(isRealTimeConnection)).append("\n"); + sb.append(" allowsTradingThroughSnaptradeApi: ").append(toIndentedString(allowsTradingThroughSnaptradeApi)).append("\n"); + sb.append(" isScrapingIntegration: ").append(toIndentedString(isScrapingIntegration)).append("\n"); + sb.append(" defaultCurrency: ").append(toIndentedString(defaultCurrency)).append("\n"); + sb.append(" brokerageType: ").append(toIndentedString(brokerageType)).append("\n"); + sb.append(" exchanges: ").append(toIndentedString(exchanges)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("display_name"); + openapiFields.add("description"); + openapiFields.add("aws_s3_logo_url"); + openapiFields.add("aws_s3_square_logo_url"); + openapiFields.add("open_url"); + openapiFields.add("slug"); + openapiFields.add("url"); + openapiFields.add("enabled"); + openapiFields.add("maintenance_mode"); + openapiFields.add("allows_fractional_units"); + openapiFields.add("allows_trading"); + openapiFields.add("has_reporting"); + openapiFields.add("is_real_time_connection"); + openapiFields.add("allows_trading_through_snaptrade_api"); + openapiFields.add("is_scraping_integration"); + openapiFields.add("default_currency"); + openapiFields.add("brokerage_type"); + openapiFields.add("exchanges"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to Brokerage + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!Brokerage.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Brokerage is not found in the empty JSON string", Brokerage.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("display_name") != null && !jsonObj.get("display_name").isJsonNull()) && !jsonObj.get("display_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `display_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("display_name").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if ((jsonObj.get("aws_s3_logo_url") != null && !jsonObj.get("aws_s3_logo_url").isJsonNull()) && !jsonObj.get("aws_s3_logo_url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `aws_s3_logo_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("aws_s3_logo_url").toString())); + } + if (!jsonObj.get("aws_s3_square_logo_url").isJsonNull() && (jsonObj.get("aws_s3_square_logo_url") != null && !jsonObj.get("aws_s3_square_logo_url").isJsonNull()) && !jsonObj.get("aws_s3_square_logo_url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `aws_s3_square_logo_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("aws_s3_square_logo_url").toString())); + } + if (!jsonObj.get("open_url").isJsonNull() && (jsonObj.get("open_url") != null && !jsonObj.get("open_url").isJsonNull()) && !jsonObj.get("open_url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `open_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("open_url").toString())); + } + if ((jsonObj.get("slug") != null && !jsonObj.get("slug").isJsonNull()) && !jsonObj.get("slug").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `slug` to be a primitive type in the JSON string but got `%s`", jsonObj.get("slug").toString())); + } + if ((jsonObj.get("url") != null && !jsonObj.get("url").isJsonNull()) && !jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("url").toString())); + } + if ((jsonObj.get("default_currency") != null && !jsonObj.get("default_currency").isJsonNull()) && !jsonObj.get("default_currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `default_currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("default_currency").toString())); + } + // validate the optional field `brokerage_type` + if (jsonObj.get("brokerage_type") != null && !jsonObj.get("brokerage_type").isJsonNull()) { + BrokerageType.validateJsonObject(jsonObj.getAsJsonObject("brokerage_type")); + } + // ensure the optional json data is an array if present + if (jsonObj.get("exchanges") != null && !jsonObj.get("exchanges").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `exchanges` to be an array in the JSON string but got `%s`", jsonObj.get("exchanges").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Brokerage.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Brokerage' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Brokerage.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Brokerage value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Brokerage read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + Brokerage instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Brokerage given an JSON string + * + * @param jsonString JSON string + * @return An instance of Brokerage + * @throws IOException if the JSON string is invalid with respect to Brokerage + */ + public static Brokerage fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Brokerage.class); + } + + /** + * Convert an instance of Brokerage to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/BrokerageAuthorization.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/BrokerageAuthorization.java new file mode 100644 index 0000000000..8658cd81a3 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/BrokerageAuthorization.java @@ -0,0 +1,621 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.Brokerage; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * BrokerageAuthorization + */@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class BrokerageAuthorization { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private UUID id; + + public static final String SERIALIZED_NAME_CREATED_DATE = "created_date"; + @SerializedName(SERIALIZED_NAME_CREATED_DATE) + private String createdDate; + + public static final String SERIALIZED_NAME_UPDATED_DATE = "updated_date"; + @SerializedName(SERIALIZED_NAME_UPDATED_DATE) + private String updatedDate; + + public static final String SERIALIZED_NAME_BROKERAGE = "brokerage"; + @SerializedName(SERIALIZED_NAME_BROKERAGE) + private Brokerage brokerage; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type; + + public static final String SERIALIZED_NAME_DISABLED = "disabled"; + @SerializedName(SERIALIZED_NAME_DISABLED) + private Boolean disabled; + + public static final String SERIALIZED_NAME_DISABLED_DATE = "disabled_date"; + @SerializedName(SERIALIZED_NAME_DISABLED_DATE) + private String disabledDate; + + public static final String SERIALIZED_NAME_META = "meta"; + @SerializedName(SERIALIZED_NAME_META) + private Map meta = null; + + public BrokerageAuthorization() { + } + + public BrokerageAuthorization id(UUID id) { + + + + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getId() { + return id; + } + + + public void setId(UUID id) { + + + + this.id = id; + } + + + public BrokerageAuthorization createdDate(String createdDate) { + + + + + this.createdDate = createdDate; + return this; + } + + /** + * Time + * @return createdDate + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2022-01-21T20:11:19.217Z", value = "Time") + + public String getCreatedDate() { + return createdDate; + } + + + public void setCreatedDate(String createdDate) { + + + + this.createdDate = createdDate; + } + + + public BrokerageAuthorization updatedDate(String updatedDate) { + + + + + this.updatedDate = updatedDate; + return this; + } + + /** + * Time + * @return updatedDate + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2022-01-21T20:11:19.217Z", value = "Time") + + public String getUpdatedDate() { + return updatedDate; + } + + + public void setUpdatedDate(String updatedDate) { + + + + this.updatedDate = updatedDate; + } + + + public BrokerageAuthorization brokerage(Brokerage brokerage) { + + + + + this.brokerage = brokerage; + return this; + } + + /** + * Get brokerage + * @return brokerage + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Brokerage getBrokerage() { + return brokerage; + } + + + public void setBrokerage(Brokerage brokerage) { + + + + this.brokerage = brokerage; + } + + + public BrokerageAuthorization name(String name) { + + + + + this.name = name; + return this; + } + + /** + * Connection Name + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Connection-1", value = "Connection Name") + + public String getName() { + return name; + } + + + public void setName(String name) { + + + + this.name = name; + } + + + public BrokerageAuthorization type(String type) { + + + + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "trade", value = "") + + public String getType() { + return type; + } + + + public void setType(String type) { + + + + this.type = type; + } + + + public BrokerageAuthorization disabled(Boolean disabled) { + + + + + this.disabled = disabled; + return this; + } + + /** + * Get disabled + * @return disabled + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "false", value = "") + + public Boolean getDisabled() { + return disabled; + } + + + public void setDisabled(Boolean disabled) { + + + + this.disabled = disabled; + } + + + public BrokerageAuthorization disabledDate(String disabledDate) { + + + + + this.disabledDate = disabledDate; + return this; + } + + /** + * Disabled date + * @return disabledDate + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2022-01-21T20:11:19.217Z", value = "Disabled date") + + public String getDisabledDate() { + return disabledDate; + } + + + public void setDisabledDate(String disabledDate) { + + + + this.disabledDate = disabledDate; + } + + + public BrokerageAuthorization meta(Map meta) { + + + + + this.meta = meta; + return this; + } + + public BrokerageAuthorization putMetaItem(String key, Object metaItem) { + if (this.meta == null) { + this.meta = new HashMap<>(); + } + this.meta.put(key, metaItem); + return this; + } + + /** + * Additional data about brokerage authorization + * @return meta + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "{\"identifier\":123456}", value = "Additional data about brokerage authorization") + + public Map getMeta() { + return meta; + } + + + public void setMeta(Map meta) { + + + + this.meta = meta; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the BrokerageAuthorization instance itself + */ + public BrokerageAuthorization putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BrokerageAuthorization brokerageAuthorization = (BrokerageAuthorization) o; + return Objects.equals(this.id, brokerageAuthorization.id) && + Objects.equals(this.createdDate, brokerageAuthorization.createdDate) && + Objects.equals(this.updatedDate, brokerageAuthorization.updatedDate) && + Objects.equals(this.brokerage, brokerageAuthorization.brokerage) && + Objects.equals(this.name, brokerageAuthorization.name) && + Objects.equals(this.type, brokerageAuthorization.type) && + Objects.equals(this.disabled, brokerageAuthorization.disabled) && + Objects.equals(this.disabledDate, brokerageAuthorization.disabledDate) && + Objects.equals(this.meta, brokerageAuthorization.meta)&& + Objects.equals(this.additionalProperties, brokerageAuthorization.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, createdDate, updatedDate, brokerage, name, type, disabled, disabledDate, meta, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BrokerageAuthorization {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" createdDate: ").append(toIndentedString(createdDate)).append("\n"); + sb.append(" updatedDate: ").append(toIndentedString(updatedDate)).append("\n"); + sb.append(" brokerage: ").append(toIndentedString(brokerage)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" disabled: ").append(toIndentedString(disabled)).append("\n"); + sb.append(" disabledDate: ").append(toIndentedString(disabledDate)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("created_date"); + openapiFields.add("updated_date"); + openapiFields.add("brokerage"); + openapiFields.add("name"); + openapiFields.add("type"); + openapiFields.add("disabled"); + openapiFields.add("disabled_date"); + openapiFields.add("meta"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to BrokerageAuthorization + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!BrokerageAuthorization.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BrokerageAuthorization is not found in the empty JSON string", BrokerageAuthorization.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("created_date") != null && !jsonObj.get("created_date").isJsonNull()) && !jsonObj.get("created_date").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `created_date` to be a primitive type in the JSON string but got `%s`", jsonObj.get("created_date").toString())); + } + if ((jsonObj.get("updated_date") != null && !jsonObj.get("updated_date").isJsonNull()) && !jsonObj.get("updated_date").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `updated_date` to be a primitive type in the JSON string but got `%s`", jsonObj.get("updated_date").toString())); + } + // validate the optional field `brokerage` + if (jsonObj.get("brokerage") != null && !jsonObj.get("brokerage").isJsonNull()) { + Brokerage.validateJsonObject(jsonObj.getAsJsonObject("brokerage")); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("disabled_date").isJsonNull() && (jsonObj.get("disabled_date") != null && !jsonObj.get("disabled_date").isJsonNull()) && !jsonObj.get("disabled_date").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `disabled_date` to be a primitive type in the JSON string but got `%s`", jsonObj.get("disabled_date").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BrokerageAuthorization.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BrokerageAuthorization' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BrokerageAuthorization.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BrokerageAuthorization value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public BrokerageAuthorization read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + BrokerageAuthorization instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BrokerageAuthorization given an JSON string + * + * @param jsonString JSON string + * @return An instance of BrokerageAuthorization + * @throws IOException if the JSON string is invalid with respect to BrokerageAuthorization + */ + public static BrokerageAuthorization fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BrokerageAuthorization.class); + } + + /** + * Convert an instance of BrokerageAuthorization to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/BrokerageAuthorizationDisabledConfirmation.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/BrokerageAuthorizationDisabledConfirmation.java new file mode 100644 index 0000000000..b612d4c042 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/BrokerageAuthorizationDisabledConfirmation.java @@ -0,0 +1,290 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * BrokerageAuthorizationDisabledConfirmation + */@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class BrokerageAuthorizationDisabledConfirmation { + public static final String SERIALIZED_NAME_DETAIL = "detail"; + @SerializedName(SERIALIZED_NAME_DETAIL) + private String detail; + + public BrokerageAuthorizationDisabledConfirmation() { + } + + public BrokerageAuthorizationDisabledConfirmation detail(String detail) { + + + + + this.detail = detail; + return this; + } + + /** + * Connection disabled confirmation + * @return detail + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Connection 0b3ebefb-ed47-43df-cd8f-729a4420b5cf has been disabled", value = "Connection disabled confirmation") + + public String getDetail() { + return detail; + } + + + public void setDetail(String detail) { + + + + this.detail = detail; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the BrokerageAuthorizationDisabledConfirmation instance itself + */ + public BrokerageAuthorizationDisabledConfirmation putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BrokerageAuthorizationDisabledConfirmation brokerageAuthorizationDisabledConfirmation = (BrokerageAuthorizationDisabledConfirmation) o; + return Objects.equals(this.detail, brokerageAuthorizationDisabledConfirmation.detail)&& + Objects.equals(this.additionalProperties, brokerageAuthorizationDisabledConfirmation.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(detail, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BrokerageAuthorizationDisabledConfirmation {\n"); + sb.append(" detail: ").append(toIndentedString(detail)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("detail"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to BrokerageAuthorizationDisabledConfirmation + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!BrokerageAuthorizationDisabledConfirmation.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BrokerageAuthorizationDisabledConfirmation is not found in the empty JSON string", BrokerageAuthorizationDisabledConfirmation.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("detail") != null && !jsonObj.get("detail").isJsonNull()) && !jsonObj.get("detail").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `detail` to be a primitive type in the JSON string but got `%s`", jsonObj.get("detail").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BrokerageAuthorizationDisabledConfirmation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BrokerageAuthorizationDisabledConfirmation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BrokerageAuthorizationDisabledConfirmation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BrokerageAuthorizationDisabledConfirmation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public BrokerageAuthorizationDisabledConfirmation read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + BrokerageAuthorizationDisabledConfirmation instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BrokerageAuthorizationDisabledConfirmation given an JSON string + * + * @param jsonString JSON string + * @return An instance of BrokerageAuthorizationDisabledConfirmation + * @throws IOException if the JSON string is invalid with respect to BrokerageAuthorizationDisabledConfirmation + */ + public static BrokerageAuthorizationDisabledConfirmation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BrokerageAuthorizationDisabledConfirmation.class); + } + + /** + * Convert an instance of BrokerageAuthorizationDisabledConfirmation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/BrokerageAuthorizationRefreshConfirmation.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/BrokerageAuthorizationRefreshConfirmation.java new file mode 100644 index 0000000000..77e848fbdd --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/BrokerageAuthorizationRefreshConfirmation.java @@ -0,0 +1,290 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * BrokerageAuthorizationRefreshConfirmation + */@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class BrokerageAuthorizationRefreshConfirmation { + public static final String SERIALIZED_NAME_DETAIL = "detail"; + @SerializedName(SERIALIZED_NAME_DETAIL) + private String detail; + + public BrokerageAuthorizationRefreshConfirmation() { + } + + public BrokerageAuthorizationRefreshConfirmation detail(String detail) { + + + + + this.detail = detail; + return this; + } + + /** + * Refresh confirmation details + * @return detail + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Connection 0b3ebefb-ed47-43df-cd8f-729a4420b5cf scheduled for refresh", value = "Refresh confirmation details") + + public String getDetail() { + return detail; + } + + + public void setDetail(String detail) { + + + + this.detail = detail; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the BrokerageAuthorizationRefreshConfirmation instance itself + */ + public BrokerageAuthorizationRefreshConfirmation putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BrokerageAuthorizationRefreshConfirmation brokerageAuthorizationRefreshConfirmation = (BrokerageAuthorizationRefreshConfirmation) o; + return Objects.equals(this.detail, brokerageAuthorizationRefreshConfirmation.detail)&& + Objects.equals(this.additionalProperties, brokerageAuthorizationRefreshConfirmation.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(detail, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BrokerageAuthorizationRefreshConfirmation {\n"); + sb.append(" detail: ").append(toIndentedString(detail)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("detail"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to BrokerageAuthorizationRefreshConfirmation + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!BrokerageAuthorizationRefreshConfirmation.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BrokerageAuthorizationRefreshConfirmation is not found in the empty JSON string", BrokerageAuthorizationRefreshConfirmation.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("detail") != null && !jsonObj.get("detail").isJsonNull()) && !jsonObj.get("detail").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `detail` to be a primitive type in the JSON string but got `%s`", jsonObj.get("detail").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BrokerageAuthorizationRefreshConfirmation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BrokerageAuthorizationRefreshConfirmation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BrokerageAuthorizationRefreshConfirmation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BrokerageAuthorizationRefreshConfirmation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public BrokerageAuthorizationRefreshConfirmation read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + BrokerageAuthorizationRefreshConfirmation instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BrokerageAuthorizationRefreshConfirmation given an JSON string + * + * @param jsonString JSON string + * @return An instance of BrokerageAuthorizationRefreshConfirmation + * @throws IOException if the JSON string is invalid with respect to BrokerageAuthorizationRefreshConfirmation + */ + public static BrokerageAuthorizationRefreshConfirmation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BrokerageAuthorizationRefreshConfirmation.class); + } + + /** + * Convert an instance of BrokerageAuthorizationRefreshConfirmation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/BrokerageAuthorizationType.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/BrokerageAuthorizationType.java new file mode 100644 index 0000000000..08cde278fc --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/BrokerageAuthorizationType.java @@ -0,0 +1,337 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * BrokerageAuthorizationType + */@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class BrokerageAuthorizationType { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + READ("read"), + + TRADE("trade"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + + public BrokerageAuthorizationType() { + } + + public BrokerageAuthorizationType type(TypeEnum type) { + + + + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + + + + this.type = type; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the BrokerageAuthorizationType instance itself + */ + public BrokerageAuthorizationType putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BrokerageAuthorizationType brokerageAuthorizationType = (BrokerageAuthorizationType) o; + return Objects.equals(this.type, brokerageAuthorizationType.type)&& + Objects.equals(this.additionalProperties, brokerageAuthorizationType.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BrokerageAuthorizationType {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to BrokerageAuthorizationType + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!BrokerageAuthorizationType.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BrokerageAuthorizationType is not found in the empty JSON string", BrokerageAuthorizationType.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BrokerageAuthorizationType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BrokerageAuthorizationType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BrokerageAuthorizationType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BrokerageAuthorizationType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public BrokerageAuthorizationType read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + BrokerageAuthorizationType instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BrokerageAuthorizationType given an JSON string + * + * @param jsonString JSON string + * @return An instance of BrokerageAuthorizationType + * @throws IOException if the JSON string is invalid with respect to BrokerageAuthorizationType + */ + public static BrokerageAuthorizationType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BrokerageAuthorizationType.class); + } + + /** + * Convert an instance of BrokerageAuthorizationType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/BrokerageAuthorizationTypeReadOnly.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/BrokerageAuthorizationTypeReadOnly.java new file mode 100644 index 0000000000..d81ed00791 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/BrokerageAuthorizationTypeReadOnly.java @@ -0,0 +1,508 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.BrokerageAuthorizationTypeReadOnlyBrokerage; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * BrokerageAuthorizationTypeReadOnly + */@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class BrokerageAuthorizationTypeReadOnly { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private UUID id; + + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + READ("read"), + + TRADE("trade"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + + /** + * Gets or Sets authType + */ + @JsonAdapter(AuthTypeEnum.Adapter.class) + public enum AuthTypeEnum { + OAUTH("OAUTH"), + + SCRAPE("SCRAPE"), + + UNOFFICIAL_API("UNOFFICIAL_API"), + + TOKEN("TOKEN"); + + private String value; + + AuthTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AuthTypeEnum fromValue(String value) { + for (AuthTypeEnum b : AuthTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final AuthTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AuthTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AuthTypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_AUTH_TYPE = "auth_type"; + @SerializedName(SERIALIZED_NAME_AUTH_TYPE) + private AuthTypeEnum authType; + + public static final String SERIALIZED_NAME_BROKERAGE = "brokerage"; + @SerializedName(SERIALIZED_NAME_BROKERAGE) + private BrokerageAuthorizationTypeReadOnlyBrokerage brokerage; + + public BrokerageAuthorizationTypeReadOnly() { + } + + public BrokerageAuthorizationTypeReadOnly id(UUID id) { + + + + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getId() { + return id; + } + + + public void setId(UUID id) { + + + + this.id = id; + } + + + public BrokerageAuthorizationTypeReadOnly type(TypeEnum type) { + + + + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + + + + this.type = type; + } + + + public BrokerageAuthorizationTypeReadOnly authType(AuthTypeEnum authType) { + + + + + this.authType = authType; + return this; + } + + /** + * Get authType + * @return authType + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public AuthTypeEnum getAuthType() { + return authType; + } + + + public void setAuthType(AuthTypeEnum authType) { + + + + this.authType = authType; + } + + + public BrokerageAuthorizationTypeReadOnly brokerage(BrokerageAuthorizationTypeReadOnlyBrokerage brokerage) { + + + + + this.brokerage = brokerage; + return this; + } + + /** + * Get brokerage + * @return brokerage + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public BrokerageAuthorizationTypeReadOnlyBrokerage getBrokerage() { + return brokerage; + } + + + public void setBrokerage(BrokerageAuthorizationTypeReadOnlyBrokerage brokerage) { + + + + this.brokerage = brokerage; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the BrokerageAuthorizationTypeReadOnly instance itself + */ + public BrokerageAuthorizationTypeReadOnly putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BrokerageAuthorizationTypeReadOnly brokerageAuthorizationTypeReadOnly = (BrokerageAuthorizationTypeReadOnly) o; + return Objects.equals(this.id, brokerageAuthorizationTypeReadOnly.id) && + Objects.equals(this.type, brokerageAuthorizationTypeReadOnly.type) && + Objects.equals(this.authType, brokerageAuthorizationTypeReadOnly.authType) && + Objects.equals(this.brokerage, brokerageAuthorizationTypeReadOnly.brokerage)&& + Objects.equals(this.additionalProperties, brokerageAuthorizationTypeReadOnly.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, authType, brokerage, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BrokerageAuthorizationTypeReadOnly {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" authType: ").append(toIndentedString(authType)).append("\n"); + sb.append(" brokerage: ").append(toIndentedString(brokerage)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("auth_type"); + openapiFields.add("brokerage"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to BrokerageAuthorizationTypeReadOnly + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!BrokerageAuthorizationTypeReadOnly.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BrokerageAuthorizationTypeReadOnly is not found in the empty JSON string", BrokerageAuthorizationTypeReadOnly.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if ((jsonObj.get("auth_type") != null && !jsonObj.get("auth_type").isJsonNull()) && !jsonObj.get("auth_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `auth_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("auth_type").toString())); + } + // validate the optional field `brokerage` + if (jsonObj.get("brokerage") != null && !jsonObj.get("brokerage").isJsonNull()) { + BrokerageAuthorizationTypeReadOnlyBrokerage.validateJsonObject(jsonObj.getAsJsonObject("brokerage")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BrokerageAuthorizationTypeReadOnly.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BrokerageAuthorizationTypeReadOnly' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BrokerageAuthorizationTypeReadOnly.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BrokerageAuthorizationTypeReadOnly value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public BrokerageAuthorizationTypeReadOnly read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + BrokerageAuthorizationTypeReadOnly instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BrokerageAuthorizationTypeReadOnly given an JSON string + * + * @param jsonString JSON string + * @return An instance of BrokerageAuthorizationTypeReadOnly + * @throws IOException if the JSON string is invalid with respect to BrokerageAuthorizationTypeReadOnly + */ + public static BrokerageAuthorizationTypeReadOnly fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BrokerageAuthorizationTypeReadOnly.class); + } + + /** + * Convert an instance of BrokerageAuthorizationTypeReadOnly to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/BrokerageAuthorizationTypeReadOnlyBrokerage.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/BrokerageAuthorizationTypeReadOnlyBrokerage.java new file mode 100644 index 0000000000..d8e4db5a4f --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/BrokerageAuthorizationTypeReadOnlyBrokerage.java @@ -0,0 +1,369 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * BrokerageAuthorizationTypeReadOnlyBrokerage + */@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class BrokerageAuthorizationTypeReadOnlyBrokerage { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private UUID id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_SLUG = "slug"; + @SerializedName(SERIALIZED_NAME_SLUG) + private String slug; + + public BrokerageAuthorizationTypeReadOnlyBrokerage() { + } + + public BrokerageAuthorizationTypeReadOnlyBrokerage id(UUID id) { + + + + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getId() { + return id; + } + + + public void setId(UUID id) { + + + + this.id = id; + } + + + public BrokerageAuthorizationTypeReadOnlyBrokerage name(String name) { + + + + + this.name = name; + return this; + } + + /** + * Full name of the brokerage. + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Questrade", value = "Full name of the brokerage.") + + public String getName() { + return name; + } + + + public void setName(String name) { + + + + this.name = name; + } + + + public BrokerageAuthorizationTypeReadOnlyBrokerage slug(String slug) { + + + + + this.slug = slug; + return this; + } + + /** + * A unique identifier for that brokerage. It is usually the name of the brokerage in capital letters and will never change. + * @return slug + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "QUESTRADE", value = "A unique identifier for that brokerage. It is usually the name of the brokerage in capital letters and will never change.") + + public String getSlug() { + return slug; + } + + + public void setSlug(String slug) { + + + + this.slug = slug; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the BrokerageAuthorizationTypeReadOnlyBrokerage instance itself + */ + public BrokerageAuthorizationTypeReadOnlyBrokerage putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BrokerageAuthorizationTypeReadOnlyBrokerage brokerageAuthorizationTypeReadOnlyBrokerage = (BrokerageAuthorizationTypeReadOnlyBrokerage) o; + return Objects.equals(this.id, brokerageAuthorizationTypeReadOnlyBrokerage.id) && + Objects.equals(this.name, brokerageAuthorizationTypeReadOnlyBrokerage.name) && + Objects.equals(this.slug, brokerageAuthorizationTypeReadOnlyBrokerage.slug)&& + Objects.equals(this.additionalProperties, brokerageAuthorizationTypeReadOnlyBrokerage.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, slug, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BrokerageAuthorizationTypeReadOnlyBrokerage {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("slug"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to BrokerageAuthorizationTypeReadOnlyBrokerage + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!BrokerageAuthorizationTypeReadOnlyBrokerage.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BrokerageAuthorizationTypeReadOnlyBrokerage is not found in the empty JSON string", BrokerageAuthorizationTypeReadOnlyBrokerage.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("slug") != null && !jsonObj.get("slug").isJsonNull()) && !jsonObj.get("slug").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `slug` to be a primitive type in the JSON string but got `%s`", jsonObj.get("slug").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BrokerageAuthorizationTypeReadOnlyBrokerage.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BrokerageAuthorizationTypeReadOnlyBrokerage' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BrokerageAuthorizationTypeReadOnlyBrokerage.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BrokerageAuthorizationTypeReadOnlyBrokerage value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public BrokerageAuthorizationTypeReadOnlyBrokerage read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + BrokerageAuthorizationTypeReadOnlyBrokerage instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BrokerageAuthorizationTypeReadOnlyBrokerage given an JSON string + * + * @param jsonString JSON string + * @return An instance of BrokerageAuthorizationTypeReadOnlyBrokerage + * @throws IOException if the JSON string is invalid with respect to BrokerageAuthorizationTypeReadOnlyBrokerage + */ + public static BrokerageAuthorizationTypeReadOnlyBrokerage fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BrokerageAuthorizationTypeReadOnlyBrokerage.class); + } + + /** + * Convert an instance of BrokerageAuthorizationTypeReadOnlyBrokerage to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/BrokerageSymbol.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/BrokerageSymbol.java new file mode 100644 index 0000000000..1e6b257aac --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/BrokerageSymbol.java @@ -0,0 +1,502 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.BrokerageAuthorization; +import com.konfigthis.client.model.OptionsSymbolNullable; +import com.konfigthis.client.model.UniversalSymbolNullable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Brokerage symbol + */ +@ApiModel(description = "Brokerage symbol")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class BrokerageSymbol { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private UUID id; + + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + @SerializedName(SERIALIZED_NAME_SYMBOL) + private UniversalSymbolNullable symbol; + + public static final String SERIALIZED_NAME_BROKERAGE_AUTHORIZATION = "brokerage_authorization"; + @SerializedName(SERIALIZED_NAME_BROKERAGE_AUTHORIZATION) + private BrokerageAuthorization brokerageAuthorization; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_ALLOWS_FRACTIONAL_UNITS = "allows_fractional_units"; + @SerializedName(SERIALIZED_NAME_ALLOWS_FRACTIONAL_UNITS) + private Boolean allowsFractionalUnits; + + public static final String SERIALIZED_NAME_OPTION_SYMBOL = "option_symbol"; + @SerializedName(SERIALIZED_NAME_OPTION_SYMBOL) + private OptionsSymbolNullable optionSymbol; + + public BrokerageSymbol() { + } + + public BrokerageSymbol id(UUID id) { + + + + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getId() { + return id; + } + + + public void setId(UUID id) { + + + + this.id = id; + } + + + public BrokerageSymbol symbol(UniversalSymbolNullable symbol) { + + + + + this.symbol = symbol; + return this; + } + + /** + * Get symbol + * @return symbol + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public UniversalSymbolNullable getSymbol() { + return symbol; + } + + + public void setSymbol(UniversalSymbolNullable symbol) { + + + + this.symbol = symbol; + } + + + public BrokerageSymbol brokerageAuthorization(BrokerageAuthorization brokerageAuthorization) { + + + + + this.brokerageAuthorization = brokerageAuthorization; + return this; + } + + /** + * Get brokerageAuthorization + * @return brokerageAuthorization + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public BrokerageAuthorization getBrokerageAuthorization() { + return brokerageAuthorization; + } + + + public void setBrokerageAuthorization(BrokerageAuthorization brokerageAuthorization) { + + + + this.brokerageAuthorization = brokerageAuthorization; + } + + + public BrokerageSymbol description(String description) { + + + + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "VANGUARD CDN AGGREGATE BOND INDEX ETF", value = "") + + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + + + + this.description = description; + } + + + public BrokerageSymbol allowsFractionalUnits(Boolean allowsFractionalUnits) { + + + + + this.allowsFractionalUnits = allowsFractionalUnits; + return this; + } + + /** + * Get allowsFractionalUnits + * @return allowsFractionalUnits + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "true", value = "") + + public Boolean getAllowsFractionalUnits() { + return allowsFractionalUnits; + } + + + public void setAllowsFractionalUnits(Boolean allowsFractionalUnits) { + + + + this.allowsFractionalUnits = allowsFractionalUnits; + } + + + public BrokerageSymbol optionSymbol(OptionsSymbolNullable optionSymbol) { + + + + + this.optionSymbol = optionSymbol; + return this; + } + + /** + * Get optionSymbol + * @return optionSymbol + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public OptionsSymbolNullable getOptionSymbol() { + return optionSymbol; + } + + + public void setOptionSymbol(OptionsSymbolNullable optionSymbol) { + + + + this.optionSymbol = optionSymbol; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the BrokerageSymbol instance itself + */ + public BrokerageSymbol putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BrokerageSymbol brokerageSymbol = (BrokerageSymbol) o; + return Objects.equals(this.id, brokerageSymbol.id) && + Objects.equals(this.symbol, brokerageSymbol.symbol) && + Objects.equals(this.brokerageAuthorization, brokerageSymbol.brokerageAuthorization) && + Objects.equals(this.description, brokerageSymbol.description) && + Objects.equals(this.allowsFractionalUnits, brokerageSymbol.allowsFractionalUnits) && + Objects.equals(this.optionSymbol, brokerageSymbol.optionSymbol)&& + Objects.equals(this.additionalProperties, brokerageSymbol.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, symbol, brokerageAuthorization, description, allowsFractionalUnits, optionSymbol, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BrokerageSymbol {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" brokerageAuthorization: ").append(toIndentedString(brokerageAuthorization)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" allowsFractionalUnits: ").append(toIndentedString(allowsFractionalUnits)).append("\n"); + sb.append(" optionSymbol: ").append(toIndentedString(optionSymbol)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("symbol"); + openapiFields.add("brokerage_authorization"); + openapiFields.add("description"); + openapiFields.add("allows_fractional_units"); + openapiFields.add("option_symbol"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to BrokerageSymbol + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!BrokerageSymbol.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BrokerageSymbol is not found in the empty JSON string", BrokerageSymbol.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `symbol` + if (jsonObj.get("symbol") != null && !jsonObj.get("symbol").isJsonNull()) { + UniversalSymbolNullable.validateJsonObject(jsonObj.getAsJsonObject("symbol")); + } + // validate the optional field `brokerage_authorization` + if (jsonObj.get("brokerage_authorization") != null && !jsonObj.get("brokerage_authorization").isJsonNull()) { + BrokerageAuthorization.validateJsonObject(jsonObj.getAsJsonObject("brokerage_authorization")); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + // validate the optional field `option_symbol` + if (jsonObj.get("option_symbol") != null && !jsonObj.get("option_symbol").isJsonNull()) { + OptionsSymbolNullable.validateJsonObject(jsonObj.getAsJsonObject("option_symbol")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BrokerageSymbol.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BrokerageSymbol' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BrokerageSymbol.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BrokerageSymbol value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public BrokerageSymbol read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + BrokerageSymbol instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BrokerageSymbol given an JSON string + * + * @param jsonString JSON string + * @return An instance of BrokerageSymbol + * @throws IOException if the JSON string is invalid with respect to BrokerageSymbol + */ + public static BrokerageSymbol fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BrokerageSymbol.class); + } + + /** + * Convert an instance of BrokerageSymbol to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/BrokerageType.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/BrokerageType.java new file mode 100644 index 0000000000..d6459a3d06 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/BrokerageType.java @@ -0,0 +1,331 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Type of brokerage + */ +@ApiModel(description = "Type of brokerage")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class BrokerageType { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private UUID id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public BrokerageType() { + } + + public BrokerageType id(UUID id) { + + + + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getId() { + return id; + } + + + public void setId(UUID id) { + + + + this.id = id; + } + + + public BrokerageType name(String name) { + + + + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Traditional Brokerage", value = "") + + public String getName() { + return name; + } + + + public void setName(String name) { + + + + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the BrokerageType instance itself + */ + public BrokerageType putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BrokerageType brokerageType = (BrokerageType) o; + return Objects.equals(this.id, brokerageType.id) && + Objects.equals(this.name, brokerageType.name)&& + Objects.equals(this.additionalProperties, brokerageType.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BrokerageType {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to BrokerageType + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!BrokerageType.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BrokerageType is not found in the empty JSON string", BrokerageType.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BrokerageType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BrokerageType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BrokerageType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BrokerageType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public BrokerageType read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + BrokerageType instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BrokerageType given an JSON string + * + * @param jsonString JSON string + * @return An instance of BrokerageType + * @throws IOException if the JSON string is invalid with respect to BrokerageType + */ + public static BrokerageType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BrokerageType.class); + } + + /** + * Convert an instance of BrokerageType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/CalculatedTrade.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/CalculatedTrade.java new file mode 100644 index 0000000000..47a5c6f649 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/CalculatedTrade.java @@ -0,0 +1,353 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.Trade; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Array of trades to make to rebalance portfolio + */ +@ApiModel(description = "Array of trades to make to rebalance portfolio")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class CalculatedTrade { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private UUID id; + + public static final String SERIALIZED_NAME_TRADES = "trades"; + @SerializedName(SERIALIZED_NAME_TRADES) + private List trades = null; + + public CalculatedTrade() { + } + + public CalculatedTrade id(UUID id) { + + + + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getId() { + return id; + } + + + public void setId(UUID id) { + + + + this.id = id; + } + + + public CalculatedTrade trades(List trades) { + + + + + this.trades = trades; + return this; + } + + public CalculatedTrade addTradesItem(Trade tradesItem) { + if (this.trades == null) { + this.trades = new ArrayList<>(); + } + this.trades.add(tradesItem); + return this; + } + + /** + * Get trades + * @return trades + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public List getTrades() { + return trades; + } + + + public void setTrades(List trades) { + + + + this.trades = trades; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CalculatedTrade instance itself + */ + public CalculatedTrade putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CalculatedTrade calculatedTrade = (CalculatedTrade) o; + return Objects.equals(this.id, calculatedTrade.id) && + Objects.equals(this.trades, calculatedTrade.trades)&& + Objects.equals(this.additionalProperties, calculatedTrade.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, trades, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CalculatedTrade {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" trades: ").append(toIndentedString(trades)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("trades"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to CalculatedTrade + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!CalculatedTrade.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CalculatedTrade is not found in the empty JSON string", CalculatedTrade.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (jsonObj.get("trades") != null && !jsonObj.get("trades").isJsonNull()) { + JsonArray jsonArraytrades = jsonObj.getAsJsonArray("trades"); + if (jsonArraytrades != null) { + // ensure the json data is an array + if (!jsonObj.get("trades").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `trades` to be an array in the JSON string but got `%s`", jsonObj.get("trades").toString())); + } + + // validate the optional field `trades` (array) + for (int i = 0; i < jsonArraytrades.size(); i++) { + Trade.validateJsonObject(jsonArraytrades.get(i).getAsJsonObject()); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CalculatedTrade.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CalculatedTrade' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CalculatedTrade.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CalculatedTrade value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public CalculatedTrade read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + CalculatedTrade instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CalculatedTrade given an JSON string + * + * @param jsonString JSON string + * @return An instance of CalculatedTrade + * @throws IOException if the JSON string is invalid with respect to CalculatedTrade + */ + public static CalculatedTrade fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CalculatedTrade.class); + } + + /** + * Convert an instance of CalculatedTrade to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/CashRestriction.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/CashRestriction.java new file mode 100644 index 0000000000..629ee3bdd6 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/CashRestriction.java @@ -0,0 +1,501 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Cash restriction rules that apply to this account when undergoing portfolio rebalance calculations. + */ +@ApiModel(description = "Cash restriction rules that apply to this account when undergoing portfolio rebalance calculations.")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class CashRestriction { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private UUID id; + + public static final String SERIALIZED_NAME_ACCOUNT = "account"; + @SerializedName(SERIALIZED_NAME_ACCOUNT) + private UUID account; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + private UUID currency; + + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + ALLOCATE_MAX("ALLOCATE_MAX"), + + RETAIN_MIN("RETAIN_MIN"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Double amount; + + public CashRestriction() { + } + + public CashRestriction id(UUID id) { + + + + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getId() { + return id; + } + + + public void setId(UUID id) { + + + + this.id = id; + } + + + public CashRestriction account(UUID account) { + + + + + this.account = account; + return this; + } + + /** + * Get account + * @return account + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getAccount() { + return account; + } + + + public void setAccount(UUID account) { + + + + this.account = account; + } + + + public CashRestriction currency(UUID currency) { + + + + + this.currency = currency; + return this; + } + + /** + * Get currency + * @return currency + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getCurrency() { + return currency; + } + + + public void setCurrency(UUID currency) { + + + + this.currency = currency; + } + + + public CashRestriction type(TypeEnum type) { + + + + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + + + + this.type = type; + } + + + public CashRestriction amount(Double amount) { + + + + + this.amount = amount; + return this; + } + + public CashRestriction amount(Integer amount) { + + + + + this.amount = amount.doubleValue(); + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "100", value = "") + + public Double getAmount() { + return amount; + } + + + public void setAmount(Double amount) { + + + + this.amount = amount; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CashRestriction instance itself + */ + public CashRestriction putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CashRestriction cashRestriction = (CashRestriction) o; + return Objects.equals(this.id, cashRestriction.id) && + Objects.equals(this.account, cashRestriction.account) && + Objects.equals(this.currency, cashRestriction.currency) && + Objects.equals(this.type, cashRestriction.type) && + Objects.equals(this.amount, cashRestriction.amount)&& + Objects.equals(this.additionalProperties, cashRestriction.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, account, currency, type, amount, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CashRestriction {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" account: ").append(toIndentedString(account)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("account"); + openapiFields.add("currency"); + openapiFields.add("type"); + openapiFields.add("amount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to CashRestriction + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!CashRestriction.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CashRestriction is not found in the empty JSON string", CashRestriction.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("account") != null && !jsonObj.get("account").isJsonNull()) && !jsonObj.get("account").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `account` to be a primitive type in the JSON string but got `%s`", jsonObj.get("account").toString())); + } + if ((jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) && !jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CashRestriction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CashRestriction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CashRestriction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CashRestriction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public CashRestriction read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + CashRestriction instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CashRestriction given an JSON string + * + * @param jsonString JSON string + * @return An instance of CashRestriction + * @throws IOException if the JSON string is invalid with respect to CashRestriction + */ + public static CashRestriction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CashRestriction.class); + } + + /** + * Convert an instance of CashRestriction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/Currency.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/Currency.java new file mode 100644 index 0000000000..6f7ba8e5de --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/Currency.java @@ -0,0 +1,370 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Describes a currency object. + */ +@ApiModel(description = "Describes a currency object.")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class Currency { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private UUID id; + + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + private String code; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public Currency() { + } + + public Currency id(UUID id) { + + + + + this.id = id; + return this; + } + + /** + * Unique identifier for the currency. This is the UUID used to reference the currency in SnapTrade. + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "87b24961-b51e-4db8-9226-f198f6518a89", value = "Unique identifier for the currency. This is the UUID used to reference the currency in SnapTrade.") + + public UUID getId() { + return id; + } + + + public void setId(UUID id) { + + + + this.id = id; + } + + + public Currency code(String code) { + + + + + this.code = code; + return this; + } + + /** + * The ISO-4217 currency code for the currency. + * @return code + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "USD", value = "The ISO-4217 currency code for the currency.") + + public String getCode() { + return code; + } + + + public void setCode(String code) { + + + + this.code = code; + } + + + public Currency name(String name) { + + + + + this.name = name; + return this; + } + + /** + * A human-friendly name of the currency. + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "US Dollar", value = "A human-friendly name of the currency.") + + public String getName() { + return name; + } + + + public void setName(String name) { + + + + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Currency instance itself + */ + public Currency putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Currency currency = (Currency) o; + return Objects.equals(this.id, currency.id) && + Objects.equals(this.code, currency.code) && + Objects.equals(this.name, currency.name)&& + Objects.equals(this.additionalProperties, currency.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, code, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Currency {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("code"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to Currency + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!Currency.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Currency is not found in the empty JSON string", Currency.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Currency.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Currency' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Currency.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Currency value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Currency read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + Currency instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Currency given an JSON string + * + * @param jsonString JSON string + * @return An instance of Currency + * @throws IOException if the JSON string is invalid with respect to Currency + */ + public static Currency fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Currency.class); + } + + /** + * Convert an instance of Currency to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/CurrencyNullable.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/CurrencyNullable.java new file mode 100644 index 0000000000..dbf834da00 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/CurrencyNullable.java @@ -0,0 +1,370 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Describes a currency object. + */ +@ApiModel(description = "Describes a currency object.")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class CurrencyNullable { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private UUID id; + + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + private String code; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public CurrencyNullable() { + } + + public CurrencyNullable id(UUID id) { + + + + + this.id = id; + return this; + } + + /** + * Unique identifier for the currency. This is the UUID used to reference the currency in SnapTrade. + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "87b24961-b51e-4db8-9226-f198f6518a89", value = "Unique identifier for the currency. This is the UUID used to reference the currency in SnapTrade.") + + public UUID getId() { + return id; + } + + + public void setId(UUID id) { + + + + this.id = id; + } + + + public CurrencyNullable code(String code) { + + + + + this.code = code; + return this; + } + + /** + * The ISO-4217 currency code for the currency. + * @return code + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "USD", value = "The ISO-4217 currency code for the currency.") + + public String getCode() { + return code; + } + + + public void setCode(String code) { + + + + this.code = code; + } + + + public CurrencyNullable name(String name) { + + + + + this.name = name; + return this; + } + + /** + * A human-friendly name of the currency. + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "US Dollar", value = "A human-friendly name of the currency.") + + public String getName() { + return name; + } + + + public void setName(String name) { + + + + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CurrencyNullable instance itself + */ + public CurrencyNullable putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CurrencyNullable currencyNullable = (CurrencyNullable) o; + return Objects.equals(this.id, currencyNullable.id) && + Objects.equals(this.code, currencyNullable.code) && + Objects.equals(this.name, currencyNullable.name)&& + Objects.equals(this.additionalProperties, currencyNullable.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, code, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CurrencyNullable {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("code"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to CurrencyNullable + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!CurrencyNullable.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CurrencyNullable is not found in the empty JSON string", CurrencyNullable.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CurrencyNullable.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CurrencyNullable' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CurrencyNullable.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CurrencyNullable value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public CurrencyNullable read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + CurrencyNullable instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CurrencyNullable given an JSON string + * + * @param jsonString JSON string + * @return An instance of CurrencyNullable + * @throws IOException if the JSON string is invalid with respect to CurrencyNullable + */ + public static CurrencyNullable fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CurrencyNullable.class); + } + + /** + * Convert an instance of CurrencyNullable to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/DeleteUserResponse.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/DeleteUserResponse.java new file mode 100644 index 0000000000..aea047c44b --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/DeleteUserResponse.java @@ -0,0 +1,330 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Response when delete user is successful + */ +@ApiModel(description = "Response when delete user is successful")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class DeleteUserResponse { + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private String status; + + public static final String SERIALIZED_NAME_USER_ID = "userId"; + @SerializedName(SERIALIZED_NAME_USER_ID) + private String userId; + + public DeleteUserResponse() { + } + + public DeleteUserResponse status(String status) { + + + + + this.status = status; + return this; + } + + /** + * Delete status + * @return status + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "deleted", value = "Delete status") + + public String getStatus() { + return status; + } + + + public void setStatus(String status) { + + + + this.status = status; + } + + + public DeleteUserResponse userId(String userId) { + + + + + this.userId = userId; + return this; + } + + /** + * SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable. + * @return userId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "snaptrade-user-123", value = "SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.") + + public String getUserId() { + return userId; + } + + + public void setUserId(String userId) { + + + + this.userId = userId; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the DeleteUserResponse instance itself + */ + public DeleteUserResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeleteUserResponse deleteUserResponse = (DeleteUserResponse) o; + return Objects.equals(this.status, deleteUserResponse.status) && + Objects.equals(this.userId, deleteUserResponse.userId)&& + Objects.equals(this.additionalProperties, deleteUserResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(status, userId, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteUserResponse {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" userId: ").append(toIndentedString(userId)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("userId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to DeleteUserResponse + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!DeleteUserResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DeleteUserResponse is not found in the empty JSON string", DeleteUserResponse.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if ((jsonObj.get("userId") != null && !jsonObj.get("userId").isJsonNull()) && !jsonObj.get("userId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `userId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("userId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeleteUserResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteUserResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DeleteUserResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteUserResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public DeleteUserResponse read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + DeleteUserResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DeleteUserResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteUserResponse + * @throws IOException if the JSON string is invalid with respect to DeleteUserResponse + */ + public static DeleteUserResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteUserResponse.class); + } + + /** + * Convert an instance of DeleteUserResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/DividendAtDate.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/DividendAtDate.java new file mode 100644 index 0000000000..df3eae942b --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/DividendAtDate.java @@ -0,0 +1,386 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * DividendAtDate + */@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class DividendAtDate { + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + @SerializedName(SERIALIZED_NAME_SYMBOL) + private String symbol; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Double amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + private String currency; + + public DividendAtDate() { + } + + public DividendAtDate symbol(String symbol) { + + + + + this.symbol = symbol; + return this; + } + + /** + * The ticker of the symbol that the dividend came from + * @return symbol + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "AAPL", value = "The ticker of the symbol that the dividend came from") + + public String getSymbol() { + return symbol; + } + + + public void setSymbol(String symbol) { + + + + this.symbol = symbol; + } + + + public DividendAtDate amount(Double amount) { + + + + + this.amount = amount; + return this; + } + + public DividendAtDate amount(Integer amount) { + + + + + this.amount = amount.doubleValue(); + return this; + } + + /** + * The amount received from the dividend + * @return amount + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "6.82", value = "The amount received from the dividend") + + public Double getAmount() { + return amount; + } + + + public void setAmount(Double amount) { + + + + this.amount = amount; + } + + + public DividendAtDate currency(String currency) { + + + + + this.currency = currency; + return this; + } + + /** + * The currency of the amount + * @return currency + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "CAD", value = "The currency of the amount") + + public String getCurrency() { + return currency; + } + + + public void setCurrency(String currency) { + + + + this.currency = currency; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the DividendAtDate instance itself + */ + public DividendAtDate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DividendAtDate dividendAtDate = (DividendAtDate) o; + return Objects.equals(this.symbol, dividendAtDate.symbol) && + Objects.equals(this.amount, dividendAtDate.amount) && + Objects.equals(this.currency, dividendAtDate.currency)&& + Objects.equals(this.additionalProperties, dividendAtDate.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(symbol, amount, currency, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DividendAtDate {\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("symbol"); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to DividendAtDate + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!DividendAtDate.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DividendAtDate is not found in the empty JSON string", DividendAtDate.openapiRequiredFields.toString())); + } + } + if (!jsonObj.get("symbol").isJsonNull() && (jsonObj.get("symbol") != null && !jsonObj.get("symbol").isJsonNull()) && !jsonObj.get("symbol").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `symbol` to be a primitive type in the JSON string but got `%s`", jsonObj.get("symbol").toString())); + } + if ((jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) && !jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DividendAtDate.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DividendAtDate' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DividendAtDate.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DividendAtDate value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public DividendAtDate read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + DividendAtDate instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DividendAtDate given an JSON string + * + * @param jsonString JSON string + * @return An instance of DividendAtDate + * @throws IOException if the JSON string is invalid with respect to DividendAtDate + */ + public static DividendAtDate fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DividendAtDate.class); + } + + /** + * Convert an instance of DividendAtDate to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/EncryptedResponse.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/EncryptedResponse.java new file mode 100644 index 0000000000..31dd89d6f9 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/EncryptedResponse.java @@ -0,0 +1,255 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.EncryptedResponseEncryptedMessageData; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * This response consists of 2 different components that must be decrypted to obtain the decrypted message * Decrypting the encryptedSharedKey The encrypted shared key is a shared key that was randomly generated by SnapTrade and encrypted using the users SSH public key provided when registering the user It is needed to decrypt the message in step 2. To decrypt the shared key, the user should have access to their SSH private key stored locally in their device An example Python code on how to decrypt the shared key is shown below ``` def decrypt_rsa_message(self, encrypted_message): from Crypto.Cipher import PKCS1_OAEP from Crypto.PublicKey import RSA from base64 import b64decode f = open('private.pem', 'r') private_key = RSA.import_key(f.read()) cipher = PKCS1_OAEP.new(private_key) return cipher.decrypt(b64decode(encrypted_message.encode())).decode() ``` * Decrypting the encryptedMessageData The data meant to be returned by an endpoint can be obtained by decrypting the encrypted message An encrypted message is a message that is encrypted using AES - MODE OCB with the shared key obtained in step one An example code to decrypt the encrypted message is shown below ``` def decrypt_aes_message(self, shared_key, encrypted_message): from Crypto.Cipher import AES from base64 import b64decode encrypted_msg = b64decode(encrypted_message[\"encryptedMessage\"].encode()) tag = b64decode(encrypted_message[\"tag\"].encode()) nonce = b64decode(encrypted_message[\"nonce\"].encode()) cipher = AES.new(shared_key.encode(), AES.MODE_OCB, nonce=nonce) return cipher.decrypt_and_verify(encrypted_msg, tag).decode() ``` + */ +@ApiModel(description = "This response consists of 2 different components that must be decrypted to obtain the decrypted message * Decrypting the encryptedSharedKey The encrypted shared key is a shared key that was randomly generated by SnapTrade and encrypted using the users SSH public key provided when registering the user It is needed to decrypt the message in step 2. To decrypt the shared key, the user should have access to their SSH private key stored locally in their device An example Python code on how to decrypt the shared key is shown below ``` def decrypt_rsa_message(self, encrypted_message): from Crypto.Cipher import PKCS1_OAEP from Crypto.PublicKey import RSA from base64 import b64decode f = open('private.pem', 'r') private_key = RSA.import_key(f.read()) cipher = PKCS1_OAEP.new(private_key) return cipher.decrypt(b64decode(encrypted_message.encode())).decode() ``` * Decrypting the encryptedMessageData The data meant to be returned by an endpoint can be obtained by decrypting the encrypted message An encrypted message is a message that is encrypted using AES - MODE OCB with the shared key obtained in step one An example code to decrypt the encrypted message is shown below ``` def decrypt_aes_message(self, shared_key, encrypted_message): from Crypto.Cipher import AES from base64 import b64decode encrypted_msg = b64decode(encrypted_message[\"encryptedMessage\"].encode()) tag = b64decode(encrypted_message[\"tag\"].encode()) nonce = b64decode(encrypted_message[\"nonce\"].encode()) cipher = AES.new(shared_key.encode(), AES.MODE_OCB, nonce=nonce) return cipher.decrypt_and_verify(encrypted_msg, tag).decode() ``` ")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class EncryptedResponse { + public static final String SERIALIZED_NAME_ENCRYPTED_SHARED_KEY = "encryptedSharedKey"; + @SerializedName(SERIALIZED_NAME_ENCRYPTED_SHARED_KEY) + private String encryptedSharedKey; + + public static final String SERIALIZED_NAME_ENCRYPTED_MESSAGE_DATA = "encryptedMessageData"; + @SerializedName(SERIALIZED_NAME_ENCRYPTED_MESSAGE_DATA) + private EncryptedResponseEncryptedMessageData encryptedMessageData; + + public EncryptedResponse() { + } + + public EncryptedResponse encryptedSharedKey(String encryptedSharedKey) { + + + + + this.encryptedSharedKey = encryptedSharedKey; + return this; + } + + /** + * Get encryptedSharedKey + * @return encryptedSharedKey + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "5UEaY9QGzcNTr8y2jGDUI79jY1OdfK9x", value = "") + + public String getEncryptedSharedKey() { + return encryptedSharedKey; + } + + + public void setEncryptedSharedKey(String encryptedSharedKey) { + + + + this.encryptedSharedKey = encryptedSharedKey; + } + + + public EncryptedResponse encryptedMessageData(EncryptedResponseEncryptedMessageData encryptedMessageData) { + + + + + this.encryptedMessageData = encryptedMessageData; + return this; + } + + /** + * Get encryptedMessageData + * @return encryptedMessageData + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public EncryptedResponseEncryptedMessageData getEncryptedMessageData() { + return encryptedMessageData; + } + + + public void setEncryptedMessageData(EncryptedResponseEncryptedMessageData encryptedMessageData) { + + + + this.encryptedMessageData = encryptedMessageData; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EncryptedResponse encryptedResponse = (EncryptedResponse) o; + return Objects.equals(this.encryptedSharedKey, encryptedResponse.encryptedSharedKey) && + Objects.equals(this.encryptedMessageData, encryptedResponse.encryptedMessageData); + } + + @Override + public int hashCode() { + return Objects.hash(encryptedSharedKey, encryptedMessageData); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EncryptedResponse {\n"); + sb.append(" encryptedSharedKey: ").append(toIndentedString(encryptedSharedKey)).append("\n"); + sb.append(" encryptedMessageData: ").append(toIndentedString(encryptedMessageData)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("encryptedSharedKey"); + openapiFields.add("encryptedMessageData"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to EncryptedResponse + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!EncryptedResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EncryptedResponse is not found in the empty JSON string", EncryptedResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonObj.entrySet(); + // check to see if the JSON string contains additional fields + for (Entry entry : entries) { + if (!EncryptedResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EncryptedResponse` properties. JSON: %s", entry.getKey(), jsonObj.toString())); + } + } + if ((jsonObj.get("encryptedSharedKey") != null && !jsonObj.get("encryptedSharedKey").isJsonNull()) && !jsonObj.get("encryptedSharedKey").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `encryptedSharedKey` to be a primitive type in the JSON string but got `%s`", jsonObj.get("encryptedSharedKey").toString())); + } + // validate the optional field `encryptedMessageData` + if (jsonObj.get("encryptedMessageData") != null && !jsonObj.get("encryptedMessageData").isJsonNull()) { + EncryptedResponseEncryptedMessageData.validateJsonObject(jsonObj.getAsJsonObject("encryptedMessageData")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EncryptedResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EncryptedResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EncryptedResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EncryptedResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EncryptedResponse read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + return thisAdapter.fromJsonTree(jsonObj); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EncryptedResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of EncryptedResponse + * @throws IOException if the JSON string is invalid with respect to EncryptedResponse + */ + public static EncryptedResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EncryptedResponse.class); + } + + /** + * Convert an instance of EncryptedResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/EncryptedResponseEncryptedMessageData.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/EncryptedResponseEncryptedMessageData.java new file mode 100644 index 0000000000..45847b6ed5 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/EncryptedResponseEncryptedMessageData.java @@ -0,0 +1,368 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * EncryptedResponseEncryptedMessageData + */@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class EncryptedResponseEncryptedMessageData { + public static final String SERIALIZED_NAME_ENCRYPTED_MESSAGE = "encryptedMessage"; + @SerializedName(SERIALIZED_NAME_ENCRYPTED_MESSAGE) + private String encryptedMessage; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + private String tag; + + public static final String SERIALIZED_NAME_NONCE = "nonce"; + @SerializedName(SERIALIZED_NAME_NONCE) + private String nonce; + + public EncryptedResponseEncryptedMessageData() { + } + + public EncryptedResponseEncryptedMessageData encryptedMessage(String encryptedMessage) { + + + + + this.encryptedMessage = encryptedMessage; + return this; + } + + /** + * Get encryptedMessage + * @return encryptedMessage + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "9Xy05vqZOfp0OpW5fLAaDw==", value = "") + + public String getEncryptedMessage() { + return encryptedMessage; + } + + + public void setEncryptedMessage(String encryptedMessage) { + + + + this.encryptedMessage = encryptedMessage; + } + + + public EncryptedResponseEncryptedMessageData tag(String tag) { + + + + + this.tag = tag; + return this; + } + + /** + * Get tag + * @return tag + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "mWZPkpQh5ktbcz6N7cTRmQ==", value = "") + + public String getTag() { + return tag; + } + + + public void setTag(String tag) { + + + + this.tag = tag; + } + + + public EncryptedResponseEncryptedMessageData nonce(String nonce) { + + + + + this.nonce = nonce; + return this; + } + + /** + * Get nonce + * @return nonce + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "None", value = "") + + public String getNonce() { + return nonce; + } + + + public void setNonce(String nonce) { + + + + this.nonce = nonce; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the EncryptedResponseEncryptedMessageData instance itself + */ + public EncryptedResponseEncryptedMessageData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EncryptedResponseEncryptedMessageData encryptedResponseEncryptedMessageData = (EncryptedResponseEncryptedMessageData) o; + return Objects.equals(this.encryptedMessage, encryptedResponseEncryptedMessageData.encryptedMessage) && + Objects.equals(this.tag, encryptedResponseEncryptedMessageData.tag) && + Objects.equals(this.nonce, encryptedResponseEncryptedMessageData.nonce)&& + Objects.equals(this.additionalProperties, encryptedResponseEncryptedMessageData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(encryptedMessage, tag, nonce, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EncryptedResponseEncryptedMessageData {\n"); + sb.append(" encryptedMessage: ").append(toIndentedString(encryptedMessage)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" nonce: ").append(toIndentedString(nonce)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("encryptedMessage"); + openapiFields.add("tag"); + openapiFields.add("nonce"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to EncryptedResponseEncryptedMessageData + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!EncryptedResponseEncryptedMessageData.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EncryptedResponseEncryptedMessageData is not found in the empty JSON string", EncryptedResponseEncryptedMessageData.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("encryptedMessage") != null && !jsonObj.get("encryptedMessage").isJsonNull()) && !jsonObj.get("encryptedMessage").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `encryptedMessage` to be a primitive type in the JSON string but got `%s`", jsonObj.get("encryptedMessage").toString())); + } + if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + if ((jsonObj.get("nonce") != null && !jsonObj.get("nonce").isJsonNull()) && !jsonObj.get("nonce").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `nonce` to be a primitive type in the JSON string but got `%s`", jsonObj.get("nonce").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EncryptedResponseEncryptedMessageData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EncryptedResponseEncryptedMessageData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EncryptedResponseEncryptedMessageData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EncryptedResponseEncryptedMessageData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public EncryptedResponseEncryptedMessageData read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + EncryptedResponseEncryptedMessageData instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EncryptedResponseEncryptedMessageData given an JSON string + * + * @param jsonString JSON string + * @return An instance of EncryptedResponseEncryptedMessageData + * @throws IOException if the JSON string is invalid with respect to EncryptedResponseEncryptedMessageData + */ + public static EncryptedResponseEncryptedMessageData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EncryptedResponseEncryptedMessageData.class); + } + + /** + * Convert an instance of EncryptedResponseEncryptedMessageData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/Exchange.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/Exchange.java new file mode 100644 index 0000000000..b39fa0107c --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/Exchange.java @@ -0,0 +1,577 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Stock Exchange + */ +@ApiModel(description = "Stock Exchange")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class Exchange { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private UUID id; + + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + private String code; + + public static final String SERIALIZED_NAME_MIC_CODE = "mic_code"; + @SerializedName(SERIALIZED_NAME_MIC_CODE) + private String micCode; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_TIMEZONE = "timezone"; + @SerializedName(SERIALIZED_NAME_TIMEZONE) + private String timezone; + + public static final String SERIALIZED_NAME_START_TIME = "start_time"; + @SerializedName(SERIALIZED_NAME_START_TIME) + private String startTime; + + public static final String SERIALIZED_NAME_CLOSE_TIME = "close_time"; + @SerializedName(SERIALIZED_NAME_CLOSE_TIME) + private String closeTime; + + public static final String SERIALIZED_NAME_SUFFIX = "suffix"; + @SerializedName(SERIALIZED_NAME_SUFFIX) + private String suffix; + + public Exchange() { + } + + public Exchange id(UUID id) { + + + + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getId() { + return id; + } + + + public void setId(UUID id) { + + + + this.id = id; + } + + + public Exchange code(String code) { + + + + + this.code = code; + return this; + } + + /** + * Get code + * @return code + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "TSX", value = "") + + public String getCode() { + return code; + } + + + public void setCode(String code) { + + + + this.code = code; + } + + + public Exchange micCode(String micCode) { + + + + + this.micCode = micCode; + return this; + } + + /** + * Get micCode + * @return micCode + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "XTSE", value = "") + + public String getMicCode() { + return micCode; + } + + + public void setMicCode(String micCode) { + + + + this.micCode = micCode; + } + + + public Exchange name(String name) { + + + + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Toronto Stock Exchange", value = "") + + public String getName() { + return name; + } + + + public void setName(String name) { + + + + this.name = name; + } + + + public Exchange timezone(String timezone) { + + + + + this.timezone = timezone; + return this; + } + + /** + * Get timezone + * @return timezone + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "America/New_York", value = "") + + public String getTimezone() { + return timezone; + } + + + public void setTimezone(String timezone) { + + + + this.timezone = timezone; + } + + + public Exchange startTime(String startTime) { + + + + + this.startTime = startTime; + return this; + } + + /** + * Get startTime + * @return startTime + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "09:30:00", value = "") + + public String getStartTime() { + return startTime; + } + + + public void setStartTime(String startTime) { + + + + this.startTime = startTime; + } + + + public Exchange closeTime(String closeTime) { + + + + + this.closeTime = closeTime; + return this; + } + + /** + * Get closeTime + * @return closeTime + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "57600", value = "") + + public String getCloseTime() { + return closeTime; + } + + + public void setCloseTime(String closeTime) { + + + + this.closeTime = closeTime; + } + + + public Exchange suffix(String suffix) { + + + + + this.suffix = suffix; + return this; + } + + /** + * Get suffix + * @return suffix + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = ".TO", value = "") + + public String getSuffix() { + return suffix; + } + + + public void setSuffix(String suffix) { + + + + this.suffix = suffix; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Exchange instance itself + */ + public Exchange putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Exchange exchange = (Exchange) o; + return Objects.equals(this.id, exchange.id) && + Objects.equals(this.code, exchange.code) && + Objects.equals(this.micCode, exchange.micCode) && + Objects.equals(this.name, exchange.name) && + Objects.equals(this.timezone, exchange.timezone) && + Objects.equals(this.startTime, exchange.startTime) && + Objects.equals(this.closeTime, exchange.closeTime) && + Objects.equals(this.suffix, exchange.suffix)&& + Objects.equals(this.additionalProperties, exchange.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, code, micCode, name, timezone, startTime, closeTime, suffix, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Exchange {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" micCode: ").append(toIndentedString(micCode)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" timezone: ").append(toIndentedString(timezone)).append("\n"); + sb.append(" startTime: ").append(toIndentedString(startTime)).append("\n"); + sb.append(" closeTime: ").append(toIndentedString(closeTime)).append("\n"); + sb.append(" suffix: ").append(toIndentedString(suffix)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("code"); + openapiFields.add("mic_code"); + openapiFields.add("name"); + openapiFields.add("timezone"); + openapiFields.add("start_time"); + openapiFields.add("close_time"); + openapiFields.add("suffix"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to Exchange + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!Exchange.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Exchange is not found in the empty JSON string", Exchange.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); + } + if ((jsonObj.get("mic_code") != null && !jsonObj.get("mic_code").isJsonNull()) && !jsonObj.get("mic_code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `mic_code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("mic_code").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("timezone") != null && !jsonObj.get("timezone").isJsonNull()) && !jsonObj.get("timezone").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `timezone` to be a primitive type in the JSON string but got `%s`", jsonObj.get("timezone").toString())); + } + if ((jsonObj.get("start_time") != null && !jsonObj.get("start_time").isJsonNull()) && !jsonObj.get("start_time").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `start_time` to be a primitive type in the JSON string but got `%s`", jsonObj.get("start_time").toString())); + } + if ((jsonObj.get("close_time") != null && !jsonObj.get("close_time").isJsonNull()) && !jsonObj.get("close_time").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `close_time` to be a primitive type in the JSON string but got `%s`", jsonObj.get("close_time").toString())); + } + if (!jsonObj.get("suffix").isJsonNull() && (jsonObj.get("suffix") != null && !jsonObj.get("suffix").isJsonNull()) && !jsonObj.get("suffix").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `suffix` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suffix").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Exchange.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Exchange' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Exchange.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Exchange value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Exchange read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + Exchange instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Exchange given an JSON string + * + * @param jsonString JSON string + * @return An instance of Exchange + * @throws IOException if the JSON string is invalid with respect to Exchange + */ + public static Exchange fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Exchange.class); + } + + /** + * Convert an instance of Exchange to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ExchangeRatePairs.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ExchangeRatePairs.java new file mode 100644 index 0000000000..e70702299a --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ExchangeRatePairs.java @@ -0,0 +1,378 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.Currency; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * The exchange rate of a pair of currencies + */ +@ApiModel(description = "The exchange rate of a pair of currencies")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class ExchangeRatePairs { + public static final String SERIALIZED_NAME_SRC = "src"; + @SerializedName(SERIALIZED_NAME_SRC) + private Currency src; + + public static final String SERIALIZED_NAME_DST = "dst"; + @SerializedName(SERIALIZED_NAME_DST) + private Currency dst; + + public static final String SERIALIZED_NAME_EXCHANGE_RATE = "exchange_rate"; + @SerializedName(SERIALIZED_NAME_EXCHANGE_RATE) + private Double exchangeRate; + + public ExchangeRatePairs() { + } + + public ExchangeRatePairs src(Currency src) { + + + + + this.src = src; + return this; + } + + /** + * Get src + * @return src + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Currency getSrc() { + return src; + } + + + public void setSrc(Currency src) { + + + + this.src = src; + } + + + public ExchangeRatePairs dst(Currency dst) { + + + + + this.dst = dst; + return this; + } + + /** + * Get dst + * @return dst + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Currency getDst() { + return dst; + } + + + public void setDst(Currency dst) { + + + + this.dst = dst; + } + + + public ExchangeRatePairs exchangeRate(Double exchangeRate) { + + + + + this.exchangeRate = exchangeRate; + return this; + } + + public ExchangeRatePairs exchangeRate(Integer exchangeRate) { + + + + + this.exchangeRate = exchangeRate.doubleValue(); + return this; + } + + /** + * Get exchangeRate + * @return exchangeRate + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "1.32", value = "") + + public Double getExchangeRate() { + return exchangeRate; + } + + + public void setExchangeRate(Double exchangeRate) { + + + + this.exchangeRate = exchangeRate; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ExchangeRatePairs instance itself + */ + public ExchangeRatePairs putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExchangeRatePairs exchangeRatePairs = (ExchangeRatePairs) o; + return Objects.equals(this.src, exchangeRatePairs.src) && + Objects.equals(this.dst, exchangeRatePairs.dst) && + Objects.equals(this.exchangeRate, exchangeRatePairs.exchangeRate)&& + Objects.equals(this.additionalProperties, exchangeRatePairs.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(src, dst, exchangeRate, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExchangeRatePairs {\n"); + sb.append(" src: ").append(toIndentedString(src)).append("\n"); + sb.append(" dst: ").append(toIndentedString(dst)).append("\n"); + sb.append(" exchangeRate: ").append(toIndentedString(exchangeRate)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("src"); + openapiFields.add("dst"); + openapiFields.add("exchange_rate"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to ExchangeRatePairs + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!ExchangeRatePairs.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExchangeRatePairs is not found in the empty JSON string", ExchangeRatePairs.openapiRequiredFields.toString())); + } + } + // validate the optional field `src` + if (jsonObj.get("src") != null && !jsonObj.get("src").isJsonNull()) { + Currency.validateJsonObject(jsonObj.getAsJsonObject("src")); + } + // validate the optional field `dst` + if (jsonObj.get("dst") != null && !jsonObj.get("dst").isJsonNull()) { + Currency.validateJsonObject(jsonObj.getAsJsonObject("dst")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExchangeRatePairs.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExchangeRatePairs' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExchangeRatePairs.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExchangeRatePairs value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ExchangeRatePairs read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + ExchangeRatePairs instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExchangeRatePairs given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExchangeRatePairs + * @throws IOException if the JSON string is invalid with respect to ExchangeRatePairs + */ + public static ExchangeRatePairs fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExchangeRatePairs.class); + } + + /** + * Convert an instance of ExchangeRatePairs to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ExcludedAsset.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ExcludedAsset.java new file mode 100644 index 0000000000..ac0e6b9f6e --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ExcludedAsset.java @@ -0,0 +1,293 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.UniversalSymbol; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * An excluded asset in a portfolio group + */ +@ApiModel(description = "An excluded asset in a portfolio group")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class ExcludedAsset { + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + @SerializedName(SERIALIZED_NAME_SYMBOL) + private UniversalSymbol symbol; + + public ExcludedAsset() { + } + + public ExcludedAsset symbol(UniversalSymbol symbol) { + + + + + this.symbol = symbol; + return this; + } + + /** + * Get symbol + * @return symbol + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public UniversalSymbol getSymbol() { + return symbol; + } + + + public void setSymbol(UniversalSymbol symbol) { + + + + this.symbol = symbol; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ExcludedAsset instance itself + */ + public ExcludedAsset putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExcludedAsset excludedAsset = (ExcludedAsset) o; + return Objects.equals(this.symbol, excludedAsset.symbol)&& + Objects.equals(this.additionalProperties, excludedAsset.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(symbol, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExcludedAsset {\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("symbol"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to ExcludedAsset + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!ExcludedAsset.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExcludedAsset is not found in the empty JSON string", ExcludedAsset.openapiRequiredFields.toString())); + } + } + // validate the optional field `symbol` + if (jsonObj.get("symbol") != null && !jsonObj.get("symbol").isJsonNull()) { + UniversalSymbol.validateJsonObject(jsonObj.getAsJsonObject("symbol")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExcludedAsset.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExcludedAsset' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExcludedAsset.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExcludedAsset value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ExcludedAsset read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + ExcludedAsset instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExcludedAsset given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExcludedAsset + * @throws IOException if the JSON string is invalid with respect to ExcludedAsset + */ + public static ExcludedAsset fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExcludedAsset.class); + } + + /** + * Convert an instance of ExcludedAsset to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/FigiInstrument.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/FigiInstrument.java new file mode 100644 index 0000000000..345fc5e7da --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/FigiInstrument.java @@ -0,0 +1,342 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Open FIGI Identifiers + */ +@ApiModel(description = "Open FIGI Identifiers")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class FigiInstrument { + public static final String SERIALIZED_NAME_FIGI_CODE = "figi_code"; + @SerializedName(SERIALIZED_NAME_FIGI_CODE) + private String figiCode; + + public static final String SERIALIZED_NAME_FIGI_SHARE_CLASS = "figi_share_class"; + @SerializedName(SERIALIZED_NAME_FIGI_SHARE_CLASS) + private String figiShareClass; + + public FigiInstrument() { + } + + public FigiInstrument figiCode(String figiCode) { + + + + + this.figiCode = figiCode; + return this; + } + + /** + * Get figiCode + * @return figiCode + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "BBG000B9Y5X2", value = "") + + public String getFigiCode() { + return figiCode; + } + + + public void setFigiCode(String figiCode) { + + + + this.figiCode = figiCode; + } + + + public FigiInstrument figiShareClass(String figiShareClass) { + + + + + this.figiShareClass = figiShareClass; + return this; + } + + /** + * Get figiShareClass + * @return figiShareClass + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "BBG001S5N8V8", value = "") + + public String getFigiShareClass() { + return figiShareClass; + } + + + public void setFigiShareClass(String figiShareClass) { + + + + this.figiShareClass = figiShareClass; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the FigiInstrument instance itself + */ + public FigiInstrument putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FigiInstrument figiInstrument = (FigiInstrument) o; + return Objects.equals(this.figiCode, figiInstrument.figiCode) && + Objects.equals(this.figiShareClass, figiInstrument.figiShareClass)&& + Objects.equals(this.additionalProperties, figiInstrument.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(figiCode, figiShareClass, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FigiInstrument {\n"); + sb.append(" figiCode: ").append(toIndentedString(figiCode)).append("\n"); + sb.append(" figiShareClass: ").append(toIndentedString(figiShareClass)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("figi_code"); + openapiFields.add("figi_share_class"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to FigiInstrument + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!FigiInstrument.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in FigiInstrument is not found in the empty JSON string", FigiInstrument.openapiRequiredFields.toString())); + } + } + if (!jsonObj.get("figi_code").isJsonNull() && (jsonObj.get("figi_code") != null && !jsonObj.get("figi_code").isJsonNull()) && !jsonObj.get("figi_code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `figi_code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("figi_code").toString())); + } + if (!jsonObj.get("figi_share_class").isJsonNull() && (jsonObj.get("figi_share_class") != null && !jsonObj.get("figi_share_class").isJsonNull()) && !jsonObj.get("figi_share_class").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `figi_share_class` to be a primitive type in the JSON string but got `%s`", jsonObj.get("figi_share_class").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FigiInstrument.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FigiInstrument' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FigiInstrument.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FigiInstrument value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public FigiInstrument read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + FigiInstrument instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FigiInstrument given an JSON string + * + * @param jsonString JSON string + * @return An instance of FigiInstrument + * @throws IOException if the JSON string is invalid with respect to FigiInstrument + */ + public static FigiInstrument fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FigiInstrument.class); + } + + /** + * Convert an instance of FigiInstrument to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/FigiInstrumentNullable.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/FigiInstrumentNullable.java new file mode 100644 index 0000000000..852e0b14fd --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/FigiInstrumentNullable.java @@ -0,0 +1,342 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Open FIGI Identifiers + */ +@ApiModel(description = "Open FIGI Identifiers")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class FigiInstrumentNullable { + public static final String SERIALIZED_NAME_FIGI_CODE = "figi_code"; + @SerializedName(SERIALIZED_NAME_FIGI_CODE) + private String figiCode; + + public static final String SERIALIZED_NAME_FIGI_SHARE_CLASS = "figi_share_class"; + @SerializedName(SERIALIZED_NAME_FIGI_SHARE_CLASS) + private String figiShareClass; + + public FigiInstrumentNullable() { + } + + public FigiInstrumentNullable figiCode(String figiCode) { + + + + + this.figiCode = figiCode; + return this; + } + + /** + * Get figiCode + * @return figiCode + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "BBG000B9Y5X2", value = "") + + public String getFigiCode() { + return figiCode; + } + + + public void setFigiCode(String figiCode) { + + + + this.figiCode = figiCode; + } + + + public FigiInstrumentNullable figiShareClass(String figiShareClass) { + + + + + this.figiShareClass = figiShareClass; + return this; + } + + /** + * Get figiShareClass + * @return figiShareClass + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "BBG001S5N8V8", value = "") + + public String getFigiShareClass() { + return figiShareClass; + } + + + public void setFigiShareClass(String figiShareClass) { + + + + this.figiShareClass = figiShareClass; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the FigiInstrumentNullable instance itself + */ + public FigiInstrumentNullable putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FigiInstrumentNullable figiInstrumentNullable = (FigiInstrumentNullable) o; + return Objects.equals(this.figiCode, figiInstrumentNullable.figiCode) && + Objects.equals(this.figiShareClass, figiInstrumentNullable.figiShareClass)&& + Objects.equals(this.additionalProperties, figiInstrumentNullable.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(figiCode, figiShareClass, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FigiInstrumentNullable {\n"); + sb.append(" figiCode: ").append(toIndentedString(figiCode)).append("\n"); + sb.append(" figiShareClass: ").append(toIndentedString(figiShareClass)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("figi_code"); + openapiFields.add("figi_share_class"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to FigiInstrumentNullable + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!FigiInstrumentNullable.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in FigiInstrumentNullable is not found in the empty JSON string", FigiInstrumentNullable.openapiRequiredFields.toString())); + } + } + if (!jsonObj.get("figi_code").isJsonNull() && (jsonObj.get("figi_code") != null && !jsonObj.get("figi_code").isJsonNull()) && !jsonObj.get("figi_code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `figi_code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("figi_code").toString())); + } + if (!jsonObj.get("figi_share_class").isJsonNull() && (jsonObj.get("figi_share_class") != null && !jsonObj.get("figi_share_class").isJsonNull()) && !jsonObj.get("figi_share_class").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `figi_share_class` to be a primitive type in the JSON string but got `%s`", jsonObj.get("figi_share_class").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FigiInstrumentNullable.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FigiInstrumentNullable' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FigiInstrumentNullable.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FigiInstrumentNullable value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public FigiInstrumentNullable read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + FigiInstrumentNullable instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FigiInstrumentNullable given an JSON string + * + * @param jsonString JSON string + * @return An instance of FigiInstrumentNullable + * @throws IOException if the JSON string is invalid with respect to FigiInstrumentNullable + */ + public static FigiInstrumentNullable fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FigiInstrumentNullable.class); + } + + /** + * Convert an instance of FigiInstrumentNullable to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/HoldingsStatus.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/HoldingsStatus.java new file mode 100644 index 0000000000..967bd2f03e --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/HoldingsStatus.java @@ -0,0 +1,339 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Status of account holdings sync + */ +@ApiModel(description = "Status of account holdings sync")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class HoldingsStatus { + public static final String SERIALIZED_NAME_INITIAL_SYNC_COMPLETED = "initial_sync_completed"; + @SerializedName(SERIALIZED_NAME_INITIAL_SYNC_COMPLETED) + private Boolean initialSyncCompleted; + + public static final String SERIALIZED_NAME_LAST_SUCCESSFUL_SYNC = "last_successful_sync"; + @SerializedName(SERIALIZED_NAME_LAST_SUCCESSFUL_SYNC) + private String lastSuccessfulSync; + + public HoldingsStatus() { + } + + public HoldingsStatus initialSyncCompleted(Boolean initialSyncCompleted) { + + + + + this.initialSyncCompleted = initialSyncCompleted; + return this; + } + + /** + * Get initialSyncCompleted + * @return initialSyncCompleted + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Boolean getInitialSyncCompleted() { + return initialSyncCompleted; + } + + + public void setInitialSyncCompleted(Boolean initialSyncCompleted) { + + + + this.initialSyncCompleted = initialSyncCompleted; + } + + + public HoldingsStatus lastSuccessfulSync(String lastSuccessfulSync) { + + + + + this.lastSuccessfulSync = lastSuccessfulSync; + return this; + } + + /** + * Date in ISO 8601 format or null (YYYY-MM-DD HH:MM:SS.mmmmmmTZ) + * @return lastSuccessfulSync + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2024-06-28 18:42:46.561408+00:00", value = "Date in ISO 8601 format or null (YYYY-MM-DD HH:MM:SS.mmmmmmTZ)") + + public String getLastSuccessfulSync() { + return lastSuccessfulSync; + } + + + public void setLastSuccessfulSync(String lastSuccessfulSync) { + + + + this.lastSuccessfulSync = lastSuccessfulSync; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the HoldingsStatus instance itself + */ + public HoldingsStatus putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HoldingsStatus holdingsStatus = (HoldingsStatus) o; + return Objects.equals(this.initialSyncCompleted, holdingsStatus.initialSyncCompleted) && + Objects.equals(this.lastSuccessfulSync, holdingsStatus.lastSuccessfulSync)&& + Objects.equals(this.additionalProperties, holdingsStatus.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(initialSyncCompleted, lastSuccessfulSync, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HoldingsStatus {\n"); + sb.append(" initialSyncCompleted: ").append(toIndentedString(initialSyncCompleted)).append("\n"); + sb.append(" lastSuccessfulSync: ").append(toIndentedString(lastSuccessfulSync)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("initial_sync_completed"); + openapiFields.add("last_successful_sync"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to HoldingsStatus + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!HoldingsStatus.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in HoldingsStatus is not found in the empty JSON string", HoldingsStatus.openapiRequiredFields.toString())); + } + } + if (!jsonObj.get("last_successful_sync").isJsonNull() && (jsonObj.get("last_successful_sync") != null && !jsonObj.get("last_successful_sync").isJsonNull()) && !jsonObj.get("last_successful_sync").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `last_successful_sync` to be a primitive type in the JSON string but got `%s`", jsonObj.get("last_successful_sync").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!HoldingsStatus.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'HoldingsStatus' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(HoldingsStatus.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, HoldingsStatus value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public HoldingsStatus read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + HoldingsStatus instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of HoldingsStatus given an JSON string + * + * @param jsonString JSON string + * @return An instance of HoldingsStatus + * @throws IOException if the JSON string is invalid with respect to HoldingsStatus + */ + public static HoldingsStatus fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, HoldingsStatus.class); + } + + /** + * Convert an instance of HoldingsStatus to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/JWT.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/JWT.java new file mode 100644 index 0000000000..5628ea7037 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/JWT.java @@ -0,0 +1,291 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * JWT Token. Used to acess resources in private endpoints available only through the Passiv app + */ +@ApiModel(description = "JWT Token. Used to acess resources in private endpoints available only through the Passiv app")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class JWT { + public static final String SERIALIZED_NAME_TOKEN = "token"; + @SerializedName(SERIALIZED_NAME_TOKEN) + private String token; + + public JWT() { + } + + public JWT token(String token) { + + + + + this.token = token; + return this; + } + + /** + * Get token + * @return token + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VybmFtZSI6ImZSbUdsbWFyU1dtZDY5RDkyeGZWbVdCWUxCS0x0QiIsImV4cCI6MTU0MDA1NTMxOSwiZW1haWwiOiJ3b29kQHN5bmNocm92ZXJnZS5jb20iLCJvcmlnX2lhdCI6MTUzNzM3NjkxOX0.ZSn85i3kSBvEP5wuhWOE8_w903N1G1AfiVlD3fmri78", value = "") + + public String getToken() { + return token; + } + + + public void setToken(String token) { + + + + this.token = token; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the JWT instance itself + */ + public JWT putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + JWT JWT = (JWT) o; + return Objects.equals(this.token, JWT.token)&& + Objects.equals(this.additionalProperties, JWT.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(token, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class JWT {\n"); + sb.append(" token: ").append(toIndentedString(token)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("token"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to JWT + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!JWT.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in JWT is not found in the empty JSON string", JWT.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("token") != null && !jsonObj.get("token").isJsonNull()) && !jsonObj.get("token").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `token` to be a primitive type in the JSON string but got `%s`", jsonObj.get("token").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!JWT.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'JWT' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(JWT.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, JWT value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public JWT read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + JWT instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of JWT given an JSON string + * + * @param jsonString JSON string + * @return An instance of JWT + * @throws IOException if the JSON string is invalid with respect to JWT + */ + public static JWT fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, JWT.class); + } + + /** + * Convert an instance of JWT to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/LoginRedirectURI.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/LoginRedirectURI.java new file mode 100644 index 0000000000..497513316a --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/LoginRedirectURI.java @@ -0,0 +1,339 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Redirect uri upon successful login + */ +@ApiModel(description = "Redirect uri upon successful login")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class LoginRedirectURI { + public static final String SERIALIZED_NAME_REDIRECT_U_R_I = "redirectURI"; + @SerializedName(SERIALIZED_NAME_REDIRECT_U_R_I) + private Object redirectURI = null; + + public static final String SERIALIZED_NAME_SESSION_ID = "sessionId"; + @SerializedName(SERIALIZED_NAME_SESSION_ID) + private String sessionId; + + public LoginRedirectURI() { + } + + public LoginRedirectURI redirectURI(Object redirectURI) { + + + + + this.redirectURI = redirectURI; + return this; + } + + /** + * Get redirectURI + * @return redirectURI + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "https://app.snaptrade.com/snapTrade/redeemToken?token=this$token1does2ntactu4allyexist==&clientId=example", value = "") + + public Object getRedirectURI() { + return redirectURI; + } + + + public void setRedirectURI(Object redirectURI) { + + + + this.redirectURI = redirectURI; + } + + + public LoginRedirectURI sessionId(String sessionId) { + + + + + this.sessionId = sessionId; + return this; + } + + /** + * Get sessionId + * @return sessionId + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public String getSessionId() { + return sessionId; + } + + + public void setSessionId(String sessionId) { + + + + this.sessionId = sessionId; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the LoginRedirectURI instance itself + */ + public LoginRedirectURI putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LoginRedirectURI loginRedirectURI = (LoginRedirectURI) o; + return Objects.equals(this.redirectURI, loginRedirectURI.redirectURI) && + Objects.equals(this.sessionId, loginRedirectURI.sessionId)&& + Objects.equals(this.additionalProperties, loginRedirectURI.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(redirectURI, sessionId, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LoginRedirectURI {\n"); + sb.append(" redirectURI: ").append(toIndentedString(redirectURI)).append("\n"); + sb.append(" sessionId: ").append(toIndentedString(sessionId)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("redirectURI"); + openapiFields.add("sessionId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to LoginRedirectURI + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!LoginRedirectURI.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in LoginRedirectURI is not found in the empty JSON string", LoginRedirectURI.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("sessionId") != null && !jsonObj.get("sessionId").isJsonNull()) && !jsonObj.get("sessionId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `sessionId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sessionId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!LoginRedirectURI.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'LoginRedirectURI' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(LoginRedirectURI.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, LoginRedirectURI value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public LoginRedirectURI read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + LoginRedirectURI instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of LoginRedirectURI given an JSON string + * + * @param jsonString JSON string + * @return An instance of LoginRedirectURI + * @throws IOException if the JSON string is invalid with respect to LoginRedirectURI + */ + public static LoginRedirectURI fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, LoginRedirectURI.class); + } + + /** + * Convert an instance of LoginRedirectURI to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ManualTrade.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ManualTrade.java new file mode 100644 index 0000000000..5a5bf47246 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ManualTrade.java @@ -0,0 +1,587 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.ActionStrict; +import com.konfigthis.client.model.ManualTradeSymbol; +import com.konfigthis.client.model.OrderTypeStrict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * A manual trade object + */ +@ApiModel(description = "A manual trade object")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class ManualTrade { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private UUID id; + + public static final String SERIALIZED_NAME_ACCOUNT = "account"; + @SerializedName(SERIALIZED_NAME_ACCOUNT) + private String account; + + public static final String SERIALIZED_NAME_ORDER_TYPE = "order_type"; + @SerializedName(SERIALIZED_NAME_ORDER_TYPE) + private OrderTypeStrict orderType; + + public static final String SERIALIZED_NAME_TIME_IN_FORCE = "time_in_force"; + @SerializedName(SERIALIZED_NAME_TIME_IN_FORCE) + private String timeInForce; + + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + @SerializedName(SERIALIZED_NAME_SYMBOL) + private ManualTradeSymbol symbol; + + public static final String SERIALIZED_NAME_ACTION = "action"; + @SerializedName(SERIALIZED_NAME_ACTION) + private ActionStrict action; + + public static final String SERIALIZED_NAME_UNITS = "units"; + @SerializedName(SERIALIZED_NAME_UNITS) + private Double units; + + public static final String SERIALIZED_NAME_PRICE = "price"; + @SerializedName(SERIALIZED_NAME_PRICE) + private Double price; + + public ManualTrade() { + } + + public ManualTrade id(UUID id) { + + + + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getId() { + return id; + } + + + public void setId(UUID id) { + + + + this.id = id; + } + + + public ManualTrade account(String account) { + + + + + this.account = account; + return this; + } + + /** + * Get account + * @return account + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9855556801c3", value = "") + + public String getAccount() { + return account; + } + + + public void setAccount(String account) { + + + + this.account = account; + } + + + public ManualTrade orderType(OrderTypeStrict orderType) { + + + + + this.orderType = orderType; + return this; + } + + /** + * Get orderType + * @return orderType + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public OrderTypeStrict getOrderType() { + return orderType; + } + + + public void setOrderType(OrderTypeStrict orderType) { + + + + this.orderType = orderType; + } + + + public ManualTrade timeInForce(String timeInForce) { + + + + + this.timeInForce = timeInForce; + return this; + } + + /** + * Trade time in force examples: * FOK - Fill Or Kill * Day - Day * GTC - Good Til Canceled * GTD - Good Til Date + * @return timeInForce + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Trade time in force examples: * FOK - Fill Or Kill * Day - Day * GTC - Good Til Canceled * GTD - Good Til Date ") + + public String getTimeInForce() { + return timeInForce; + } + + + public void setTimeInForce(String timeInForce) { + + + + this.timeInForce = timeInForce; + } + + + public ManualTrade symbol(ManualTradeSymbol symbol) { + + + + + this.symbol = symbol; + return this; + } + + /** + * Get symbol + * @return symbol + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public ManualTradeSymbol getSymbol() { + return symbol; + } + + + public void setSymbol(ManualTradeSymbol symbol) { + + + + this.symbol = symbol; + } + + + public ManualTrade action(ActionStrict action) { + + + + + this.action = action; + return this; + } + + /** + * Get action + * @return action + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public ActionStrict getAction() { + return action; + } + + + public void setAction(ActionStrict action) { + + + + this.action = action; + } + + + public ManualTrade units(Double units) { + + + + + this.units = units; + return this; + } + + public ManualTrade units(Integer units) { + + + + + this.units = units.doubleValue(); + return this; + } + + /** + * Trade Units. Cannot work with notional value. + * @return units + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Trade Units. Cannot work with notional value.") + + public Double getUnits() { + return units; + } + + + public void setUnits(Double units) { + + + + this.units = units; + } + + + public ManualTrade price(Double price) { + + + + + this.price = price; + return this; + } + + public ManualTrade price(Integer price) { + + + + + this.price = price.doubleValue(); + return this; + } + + /** + * Trade Price if limit or stop limit order + * @return price + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "31.33", value = "Trade Price if limit or stop limit order") + + public Double getPrice() { + return price; + } + + + public void setPrice(Double price) { + + + + this.price = price; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ManualTrade instance itself + */ + public ManualTrade putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ManualTrade manualTrade = (ManualTrade) o; + return Objects.equals(this.id, manualTrade.id) && + Objects.equals(this.account, manualTrade.account) && + Objects.equals(this.orderType, manualTrade.orderType) && + Objects.equals(this.timeInForce, manualTrade.timeInForce) && + Objects.equals(this.symbol, manualTrade.symbol) && + Objects.equals(this.action, manualTrade.action) && + Objects.equals(this.units, manualTrade.units) && + Objects.equals(this.price, manualTrade.price)&& + Objects.equals(this.additionalProperties, manualTrade.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, account, orderType, timeInForce, symbol, action, units, price, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ManualTrade {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" account: ").append(toIndentedString(account)).append("\n"); + sb.append(" orderType: ").append(toIndentedString(orderType)).append("\n"); + sb.append(" timeInForce: ").append(toIndentedString(timeInForce)).append("\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" action: ").append(toIndentedString(action)).append("\n"); + sb.append(" units: ").append(toIndentedString(units)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("account"); + openapiFields.add("order_type"); + openapiFields.add("time_in_force"); + openapiFields.add("symbol"); + openapiFields.add("action"); + openapiFields.add("units"); + openapiFields.add("price"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to ManualTrade + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!ManualTrade.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ManualTrade is not found in the empty JSON string", ManualTrade.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("account") != null && !jsonObj.get("account").isJsonNull()) && !jsonObj.get("account").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `account` to be a primitive type in the JSON string but got `%s`", jsonObj.get("account").toString())); + } + if ((jsonObj.get("time_in_force") != null && !jsonObj.get("time_in_force").isJsonNull()) && !jsonObj.get("time_in_force").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `time_in_force` to be a primitive type in the JSON string but got `%s`", jsonObj.get("time_in_force").toString())); + } + // validate the optional field `symbol` + if (jsonObj.get("symbol") != null && !jsonObj.get("symbol").isJsonNull()) { + ManualTradeSymbol.validateJsonObject(jsonObj.getAsJsonObject("symbol")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ManualTrade.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ManualTrade' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ManualTrade.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ManualTrade value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ManualTrade read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + ManualTrade instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ManualTrade given an JSON string + * + * @param jsonString JSON string + * @return An instance of ManualTrade + * @throws IOException if the JSON string is invalid with respect to ManualTrade + */ + public static ManualTrade fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ManualTrade.class); + } + + /** + * Convert an instance of ManualTrade to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ManualTradeAndImpact.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ManualTradeAndImpact.java new file mode 100644 index 0000000000..626bde20cb --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ManualTradeAndImpact.java @@ -0,0 +1,394 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.ManualTrade; +import com.konfigthis.client.model.ManualTradeBalance; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Manual Trade and Impact object + */ +@ApiModel(description = "Manual Trade and Impact object")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class ManualTradeAndImpact { + public static final String SERIALIZED_NAME_TRADE = "trade"; + @SerializedName(SERIALIZED_NAME_TRADE) + private ManualTrade trade; + + public static final String SERIALIZED_NAME_TRADE_IMPACTS = "trade_impacts"; + @SerializedName(SERIALIZED_NAME_TRADE_IMPACTS) + private List tradeImpacts = null; + + public static final String SERIALIZED_NAME_COMBINED_REMAINING_BALANCE = "combined_remaining_balance"; + @SerializedName(SERIALIZED_NAME_COMBINED_REMAINING_BALANCE) + private ManualTradeBalance combinedRemainingBalance; + + public ManualTradeAndImpact() { + } + + public ManualTradeAndImpact trade(ManualTrade trade) { + + + + + this.trade = trade; + return this; + } + + /** + * Get trade + * @return trade + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public ManualTrade getTrade() { + return trade; + } + + + public void setTrade(ManualTrade trade) { + + + + this.trade = trade; + } + + + public ManualTradeAndImpact tradeImpacts(List tradeImpacts) { + + + + + this.tradeImpacts = tradeImpacts; + return this; + } + + public ManualTradeAndImpact addTradeImpactsItem(ManualTrade tradeImpactsItem) { + if (this.tradeImpacts == null) { + this.tradeImpacts = new ArrayList<>(); + } + this.tradeImpacts.add(tradeImpactsItem); + return this; + } + + /** + * Get tradeImpacts + * @return tradeImpacts + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public List getTradeImpacts() { + return tradeImpacts; + } + + + public void setTradeImpacts(List tradeImpacts) { + + + + this.tradeImpacts = tradeImpacts; + } + + + public ManualTradeAndImpact combinedRemainingBalance(ManualTradeBalance combinedRemainingBalance) { + + + + + this.combinedRemainingBalance = combinedRemainingBalance; + return this; + } + + /** + * Get combinedRemainingBalance + * @return combinedRemainingBalance + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public ManualTradeBalance getCombinedRemainingBalance() { + return combinedRemainingBalance; + } + + + public void setCombinedRemainingBalance(ManualTradeBalance combinedRemainingBalance) { + + + + this.combinedRemainingBalance = combinedRemainingBalance; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ManualTradeAndImpact instance itself + */ + public ManualTradeAndImpact putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ManualTradeAndImpact manualTradeAndImpact = (ManualTradeAndImpact) o; + return Objects.equals(this.trade, manualTradeAndImpact.trade) && + Objects.equals(this.tradeImpacts, manualTradeAndImpact.tradeImpacts) && + Objects.equals(this.combinedRemainingBalance, manualTradeAndImpact.combinedRemainingBalance)&& + Objects.equals(this.additionalProperties, manualTradeAndImpact.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(trade, tradeImpacts, combinedRemainingBalance, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ManualTradeAndImpact {\n"); + sb.append(" trade: ").append(toIndentedString(trade)).append("\n"); + sb.append(" tradeImpacts: ").append(toIndentedString(tradeImpacts)).append("\n"); + sb.append(" combinedRemainingBalance: ").append(toIndentedString(combinedRemainingBalance)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("trade"); + openapiFields.add("trade_impacts"); + openapiFields.add("combined_remaining_balance"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to ManualTradeAndImpact + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!ManualTradeAndImpact.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ManualTradeAndImpact is not found in the empty JSON string", ManualTradeAndImpact.openapiRequiredFields.toString())); + } + } + // validate the optional field `trade` + if (jsonObj.get("trade") != null && !jsonObj.get("trade").isJsonNull()) { + ManualTrade.validateJsonObject(jsonObj.getAsJsonObject("trade")); + } + if (jsonObj.get("trade_impacts") != null && !jsonObj.get("trade_impacts").isJsonNull()) { + JsonArray jsonArraytradeImpacts = jsonObj.getAsJsonArray("trade_impacts"); + if (jsonArraytradeImpacts != null) { + // ensure the json data is an array + if (!jsonObj.get("trade_impacts").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `trade_impacts` to be an array in the JSON string but got `%s`", jsonObj.get("trade_impacts").toString())); + } + + // validate the optional field `trade_impacts` (array) + for (int i = 0; i < jsonArraytradeImpacts.size(); i++) { + ManualTrade.validateJsonObject(jsonArraytradeImpacts.get(i).getAsJsonObject()); + }; + } + } + // validate the optional field `combined_remaining_balance` + if (jsonObj.get("combined_remaining_balance") != null && !jsonObj.get("combined_remaining_balance").isJsonNull()) { + ManualTradeBalance.validateJsonObject(jsonObj.getAsJsonObject("combined_remaining_balance")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ManualTradeAndImpact.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ManualTradeAndImpact' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ManualTradeAndImpact.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ManualTradeAndImpact value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ManualTradeAndImpact read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + ManualTradeAndImpact instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ManualTradeAndImpact given an JSON string + * + * @param jsonString JSON string + * @return An instance of ManualTradeAndImpact + * @throws IOException if the JSON string is invalid with respect to ManualTradeAndImpact + */ + public static ManualTradeAndImpact fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ManualTradeAndImpact.class); + } + + /** + * Convert an instance of ManualTradeAndImpact to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ManualTradeBalance.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ManualTradeBalance.java new file mode 100644 index 0000000000..0fec230925 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ManualTradeBalance.java @@ -0,0 +1,391 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.Account; +import com.konfigthis.client.model.Currency; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Balance + */ +@ApiModel(description = "Balance")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class ManualTradeBalance { + public static final String SERIALIZED_NAME_ACCOUNT = "account"; + @SerializedName(SERIALIZED_NAME_ACCOUNT) + private Account account; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + private Currency currency; + + public static final String SERIALIZED_NAME_CASH = "cash"; + @SerializedName(SERIALIZED_NAME_CASH) + private Double cash; + + public ManualTradeBalance() { + } + + public ManualTradeBalance account(Account account) { + + + + + this.account = account; + return this; + } + + /** + * Get account + * @return account + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Account getAccount() { + return account; + } + + + public void setAccount(Account account) { + + + + this.account = account; + } + + + public ManualTradeBalance currency(Currency currency) { + + + + + this.currency = currency; + return this; + } + + /** + * Get currency + * @return currency + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Currency getCurrency() { + return currency; + } + + + public void setCurrency(Currency currency) { + + + + this.currency = currency; + } + + + public ManualTradeBalance cash(Double cash) { + + + + + this.cash = cash; + return this; + } + + public ManualTradeBalance cash(Integer cash) { + + + + + this.cash = cash.doubleValue(); + return this; + } + + /** + * Cash + * @return cash + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "1.11", value = "Cash") + + public Double getCash() { + return cash; + } + + + public void setCash(Double cash) { + + + + this.cash = cash; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ManualTradeBalance instance itself + */ + public ManualTradeBalance putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ManualTradeBalance manualTradeBalance = (ManualTradeBalance) o; + return Objects.equals(this.account, manualTradeBalance.account) && + Objects.equals(this.currency, manualTradeBalance.currency) && + Objects.equals(this.cash, manualTradeBalance.cash)&& + Objects.equals(this.additionalProperties, manualTradeBalance.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(account, currency, cash, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ManualTradeBalance {\n"); + sb.append(" account: ").append(toIndentedString(account)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append(" cash: ").append(toIndentedString(cash)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("account"); + openapiFields.add("currency"); + openapiFields.add("cash"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to ManualTradeBalance + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!ManualTradeBalance.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ManualTradeBalance is not found in the empty JSON string", ManualTradeBalance.openapiRequiredFields.toString())); + } + } + // validate the optional field `account` + if (jsonObj.get("account") != null && !jsonObj.get("account").isJsonNull()) { + Account.validateJsonObject(jsonObj.getAsJsonObject("account")); + } + // validate the optional field `currency` + if (jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) { + Currency.validateJsonObject(jsonObj.getAsJsonObject("currency")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ManualTradeBalance.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ManualTradeBalance' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ManualTradeBalance.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ManualTradeBalance value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ManualTradeBalance read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + ManualTradeBalance instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ManualTradeBalance given an JSON string + * + * @param jsonString JSON string + * @return An instance of ManualTradeBalance + * @throws IOException if the JSON string is invalid with respect to ManualTradeBalance + */ + public static ManualTradeBalance fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ManualTradeBalance.class); + } + + /** + * Convert an instance of ManualTradeBalance to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ManualTradeForm.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ManualTradeForm.java new file mode 100644 index 0000000000..e5f74812b9 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ManualTradeForm.java @@ -0,0 +1,625 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.ActionStrict; +import com.konfigthis.client.model.OrderTypeStrict; +import com.konfigthis.client.model.TimeInForceStrict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Manual Trade Form + */ +@ApiModel(description = "Manual Trade Form")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class ManualTradeForm { + public static final String SERIALIZED_NAME_ACCOUNT_ID = "account_id"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + private UUID accountId; + + public static final String SERIALIZED_NAME_ACTION = "action"; + @SerializedName(SERIALIZED_NAME_ACTION) + private ActionStrict action; + + public static final String SERIALIZED_NAME_ORDER_TYPE = "order_type"; + @SerializedName(SERIALIZED_NAME_ORDER_TYPE) + private OrderTypeStrict orderType; + + public static final String SERIALIZED_NAME_PRICE = "price"; + @SerializedName(SERIALIZED_NAME_PRICE) + private Double price; + + public static final String SERIALIZED_NAME_STOP = "stop"; + @SerializedName(SERIALIZED_NAME_STOP) + private Double stop; + + public static final String SERIALIZED_NAME_TIME_IN_FORCE = "time_in_force"; + @SerializedName(SERIALIZED_NAME_TIME_IN_FORCE) + private TimeInForceStrict timeInForce; + + public static final String SERIALIZED_NAME_UNITS = "units"; + @SerializedName(SERIALIZED_NAME_UNITS) + private Double units; + + public static final String SERIALIZED_NAME_UNIVERSAL_SYMBOL_ID = "universal_symbol_id"; + @SerializedName(SERIALIZED_NAME_UNIVERSAL_SYMBOL_ID) + private UUID universalSymbolId; + + public static final String SERIALIZED_NAME_NOTIONAL_VALUE = "notional_value"; + @SerializedName(SERIALIZED_NAME_NOTIONAL_VALUE) + private Object notionalValue = null; + + public ManualTradeForm() { + } + + public ManualTradeForm accountId(UUID accountId) { + + + + + this.accountId = accountId; + return this; + } + + /** + * Get accountId + * @return accountId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getAccountId() { + return accountId; + } + + + public void setAccountId(UUID accountId) { + + + + this.accountId = accountId; + } + + + public ManualTradeForm action(ActionStrict action) { + + + + + this.action = action; + return this; + } + + /** + * Get action + * @return action + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public ActionStrict getAction() { + return action; + } + + + public void setAction(ActionStrict action) { + + + + this.action = action; + } + + + public ManualTradeForm orderType(OrderTypeStrict orderType) { + + + + + this.orderType = orderType; + return this; + } + + /** + * Get orderType + * @return orderType + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public OrderTypeStrict getOrderType() { + return orderType; + } + + + public void setOrderType(OrderTypeStrict orderType) { + + + + this.orderType = orderType; + } + + + public ManualTradeForm price(Double price) { + + + + + this.price = price; + return this; + } + + public ManualTradeForm price(Integer price) { + + + + + this.price = price.doubleValue(); + return this; + } + + /** + * Trade Price if limit or stop limit order + * @return price + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "31.33", value = "Trade Price if limit or stop limit order") + + public Double getPrice() { + return price; + } + + + public void setPrice(Double price) { + + + + this.price = price; + } + + + public ManualTradeForm stop(Double stop) { + + + + + this.stop = stop; + return this; + } + + public ManualTradeForm stop(Integer stop) { + + + + + this.stop = stop.doubleValue(); + return this; + } + + /** + * Stop Price. If stop loss or stop limit order, the price to trigger the stop + * @return stop + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "31.33", value = "Stop Price. If stop loss or stop limit order, the price to trigger the stop") + + public Double getStop() { + return stop; + } + + + public void setStop(Double stop) { + + + + this.stop = stop; + } + + + public ManualTradeForm timeInForce(TimeInForceStrict timeInForce) { + + + + + this.timeInForce = timeInForce; + return this; + } + + /** + * Get timeInForce + * @return timeInForce + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public TimeInForceStrict getTimeInForce() { + return timeInForce; + } + + + public void setTimeInForce(TimeInForceStrict timeInForce) { + + + + this.timeInForce = timeInForce; + } + + + public ManualTradeForm units(Double units) { + + + + + this.units = units; + return this; + } + + public ManualTradeForm units(Integer units) { + + + + + this.units = units.doubleValue(); + return this; + } + + /** + * Trade Units. Cannot work with notional value. + * @return units + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Trade Units. Cannot work with notional value.") + + public Double getUnits() { + return units; + } + + + public void setUnits(Double units) { + + + + this.units = units; + } + + + public ManualTradeForm universalSymbolId(UUID universalSymbolId) { + + + + + this.universalSymbolId = universalSymbolId; + return this; + } + + /** + * Get universalSymbolId + * @return universalSymbolId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getUniversalSymbolId() { + return universalSymbolId; + } + + + public void setUniversalSymbolId(UUID universalSymbolId) { + + + + this.universalSymbolId = universalSymbolId; + } + + + public ManualTradeForm notionalValue(Object notionalValue) { + + + + + this.notionalValue = notionalValue; + return this; + } + + /** + * Get notionalValue + * @return notionalValue + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Object getNotionalValue() { + return notionalValue; + } + + + public void setNotionalValue(Object notionalValue) { + + + + this.notionalValue = notionalValue; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ManualTradeForm instance itself + */ + public ManualTradeForm putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ManualTradeForm manualTradeForm = (ManualTradeForm) o; + return Objects.equals(this.accountId, manualTradeForm.accountId) && + Objects.equals(this.action, manualTradeForm.action) && + Objects.equals(this.orderType, manualTradeForm.orderType) && + Objects.equals(this.price, manualTradeForm.price) && + Objects.equals(this.stop, manualTradeForm.stop) && + Objects.equals(this.timeInForce, manualTradeForm.timeInForce) && + Objects.equals(this.units, manualTradeForm.units) && + Objects.equals(this.universalSymbolId, manualTradeForm.universalSymbolId) && + Objects.equals(this.notionalValue, manualTradeForm.notionalValue)&& + Objects.equals(this.additionalProperties, manualTradeForm.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(accountId, action, orderType, price, stop, timeInForce, units, universalSymbolId, notionalValue, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ManualTradeForm {\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" action: ").append(toIndentedString(action)).append("\n"); + sb.append(" orderType: ").append(toIndentedString(orderType)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append(" stop: ").append(toIndentedString(stop)).append("\n"); + sb.append(" timeInForce: ").append(toIndentedString(timeInForce)).append("\n"); + sb.append(" units: ").append(toIndentedString(units)).append("\n"); + sb.append(" universalSymbolId: ").append(toIndentedString(universalSymbolId)).append("\n"); + sb.append(" notionalValue: ").append(toIndentedString(notionalValue)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("account_id"); + openapiFields.add("action"); + openapiFields.add("order_type"); + openapiFields.add("price"); + openapiFields.add("stop"); + openapiFields.add("time_in_force"); + openapiFields.add("units"); + openapiFields.add("universal_symbol_id"); + openapiFields.add("notional_value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to ManualTradeForm + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!ManualTradeForm.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ManualTradeForm is not found in the empty JSON string", ManualTradeForm.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("account_id") != null && !jsonObj.get("account_id").isJsonNull()) && !jsonObj.get("account_id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `account_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("account_id").toString())); + } + if ((jsonObj.get("universal_symbol_id") != null && !jsonObj.get("universal_symbol_id").isJsonNull()) && !jsonObj.get("universal_symbol_id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `universal_symbol_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("universal_symbol_id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ManualTradeForm.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ManualTradeForm' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ManualTradeForm.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ManualTradeForm value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ManualTradeForm read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + ManualTradeForm instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ManualTradeForm given an JSON string + * + * @param jsonString JSON string + * @return An instance of ManualTradeForm + * @throws IOException if the JSON string is invalid with respect to ManualTradeForm + */ + public static ManualTradeForm fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ManualTradeForm.class); + } + + /** + * Convert an instance of ManualTradeForm to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ManualTradeSymbol.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ManualTradeSymbol.java new file mode 100644 index 0000000000..c60afa3cc5 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ManualTradeSymbol.java @@ -0,0 +1,501 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.Currency; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Manual trade symbol object + */ +@ApiModel(description = "Manual trade symbol object")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class ManualTradeSymbol { + public static final String SERIALIZED_NAME_BROKERAGE_SYMBOL_ID = "brokerage_symbol_id"; + @SerializedName(SERIALIZED_NAME_BROKERAGE_SYMBOL_ID) + private UUID brokerageSymbolId; + + public static final String SERIALIZED_NAME_UNIVERSAL_SYMBOL_ID = "universal_symbol_id"; + @SerializedName(SERIALIZED_NAME_UNIVERSAL_SYMBOL_ID) + private UUID universalSymbolId; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + private Currency currency; + + public static final String SERIALIZED_NAME_LOCAL_ID = "local_id"; + @SerializedName(SERIALIZED_NAME_LOCAL_ID) + private String localId; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + @SerializedName(SERIALIZED_NAME_SYMBOL) + private String symbol; + + public ManualTradeSymbol() { + } + + public ManualTradeSymbol brokerageSymbolId(UUID brokerageSymbolId) { + + + + + this.brokerageSymbolId = brokerageSymbolId; + return this; + } + + /** + * Get brokerageSymbolId + * @return brokerageSymbolId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getBrokerageSymbolId() { + return brokerageSymbolId; + } + + + public void setBrokerageSymbolId(UUID brokerageSymbolId) { + + + + this.brokerageSymbolId = brokerageSymbolId; + } + + + public ManualTradeSymbol universalSymbolId(UUID universalSymbolId) { + + + + + this.universalSymbolId = universalSymbolId; + return this; + } + + /** + * Get universalSymbolId + * @return universalSymbolId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getUniversalSymbolId() { + return universalSymbolId; + } + + + public void setUniversalSymbolId(UUID universalSymbolId) { + + + + this.universalSymbolId = universalSymbolId; + } + + + public ManualTradeSymbol currency(Currency currency) { + + + + + this.currency = currency; + return this; + } + + /** + * Get currency + * @return currency + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Currency getCurrency() { + return currency; + } + + + public void setCurrency(Currency currency) { + + + + this.currency = currency; + } + + + public ManualTradeSymbol localId(String localId) { + + + + + this.localId = localId; + return this; + } + + /** + * Get localId + * @return localId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "1048101", value = "") + + public String getLocalId() { + return localId; + } + + + public void setLocalId(String localId) { + + + + this.localId = localId; + } + + + public ManualTradeSymbol description(String description) { + + + + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Metaverse Global ETF", value = "") + + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + + + + this.description = description; + } + + + public ManualTradeSymbol symbol(String symbol) { + + + + + this.symbol = symbol; + return this; + } + + /** + * Get symbol + * @return symbol + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "MVGP.U.TO", value = "") + + public String getSymbol() { + return symbol; + } + + + public void setSymbol(String symbol) { + + + + this.symbol = symbol; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ManualTradeSymbol instance itself + */ + public ManualTradeSymbol putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ManualTradeSymbol manualTradeSymbol = (ManualTradeSymbol) o; + return Objects.equals(this.brokerageSymbolId, manualTradeSymbol.brokerageSymbolId) && + Objects.equals(this.universalSymbolId, manualTradeSymbol.universalSymbolId) && + Objects.equals(this.currency, manualTradeSymbol.currency) && + Objects.equals(this.localId, manualTradeSymbol.localId) && + Objects.equals(this.description, manualTradeSymbol.description) && + Objects.equals(this.symbol, manualTradeSymbol.symbol)&& + Objects.equals(this.additionalProperties, manualTradeSymbol.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(brokerageSymbolId, universalSymbolId, currency, localId, description, symbol, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ManualTradeSymbol {\n"); + sb.append(" brokerageSymbolId: ").append(toIndentedString(brokerageSymbolId)).append("\n"); + sb.append(" universalSymbolId: ").append(toIndentedString(universalSymbolId)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append(" localId: ").append(toIndentedString(localId)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("brokerage_symbol_id"); + openapiFields.add("universal_symbol_id"); + openapiFields.add("currency"); + openapiFields.add("local_id"); + openapiFields.add("description"); + openapiFields.add("symbol"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to ManualTradeSymbol + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!ManualTradeSymbol.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ManualTradeSymbol is not found in the empty JSON string", ManualTradeSymbol.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("brokerage_symbol_id") != null && !jsonObj.get("brokerage_symbol_id").isJsonNull()) && !jsonObj.get("brokerage_symbol_id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `brokerage_symbol_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("brokerage_symbol_id").toString())); + } + if ((jsonObj.get("universal_symbol_id") != null && !jsonObj.get("universal_symbol_id").isJsonNull()) && !jsonObj.get("universal_symbol_id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `universal_symbol_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("universal_symbol_id").toString())); + } + // validate the optional field `currency` + if (jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) { + Currency.validateJsonObject(jsonObj.getAsJsonObject("currency")); + } + if ((jsonObj.get("local_id") != null && !jsonObj.get("local_id").isJsonNull()) && !jsonObj.get("local_id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `local_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("local_id").toString())); + } + if (!jsonObj.get("description").isJsonNull() && (jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if ((jsonObj.get("symbol") != null && !jsonObj.get("symbol").isJsonNull()) && !jsonObj.get("symbol").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `symbol` to be a primitive type in the JSON string but got `%s`", jsonObj.get("symbol").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ManualTradeSymbol.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ManualTradeSymbol' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ManualTradeSymbol.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ManualTradeSymbol value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ManualTradeSymbol read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + ManualTradeSymbol instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ManualTradeSymbol given an JSON string + * + * @param jsonString JSON string + * @return An instance of ManualTradeSymbol + * @throws IOException if the JSON string is invalid with respect to ManualTradeSymbol + */ + public static ManualTradeSymbol fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ManualTradeSymbol.class); + } + + /** + * Convert an instance of ManualTradeSymbol to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ModelAssetClass.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ModelAssetClass.java new file mode 100644 index 0000000000..ce78301ad5 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ModelAssetClass.java @@ -0,0 +1,330 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * ModelAssetClass + */@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class ModelAssetClass { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private UUID id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public ModelAssetClass() { + } + + public ModelAssetClass id(UUID id) { + + + + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getId() { + return id; + } + + + public void setId(UUID id) { + + + + this.id = id; + } + + + public ModelAssetClass name(String name) { + + + + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Bonds", value = "") + + public String getName() { + return name; + } + + + public void setName(String name) { + + + + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelAssetClass instance itself + */ + public ModelAssetClass putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelAssetClass modelAssetClass = (ModelAssetClass) o; + return Objects.equals(this.id, modelAssetClass.id) && + Objects.equals(this.name, modelAssetClass.name)&& + Objects.equals(this.additionalProperties, modelAssetClass.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelAssetClass {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to ModelAssetClass + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!ModelAssetClass.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ModelAssetClass is not found in the empty JSON string", ModelAssetClass.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModelAssetClass.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModelAssetClass' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModelAssetClass.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModelAssetClass value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ModelAssetClass read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + ModelAssetClass instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModelAssetClass given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModelAssetClass + * @throws IOException if the JSON string is invalid with respect to ModelAssetClass + */ + public static ModelAssetClass fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModelAssetClass.class); + } + + /** + * Convert an instance of ModelAssetClass to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ModelAssetClassDetails.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ModelAssetClassDetails.java new file mode 100644 index 0000000000..bc46c7d688 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ModelAssetClassDetails.java @@ -0,0 +1,353 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.ModelAssetClass; +import com.konfigthis.client.model.ModelAssetClassTarget; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * ModelAssetClassDetails + */@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class ModelAssetClassDetails { + public static final String SERIALIZED_NAME_MODEL_ASSET_CLASS = "model_asset_class"; + @SerializedName(SERIALIZED_NAME_MODEL_ASSET_CLASS) + private ModelAssetClass modelAssetClass; + + public static final String SERIALIZED_NAME_MODEL_ASSET_CLASS_TARGET = "model_asset_class_target"; + @SerializedName(SERIALIZED_NAME_MODEL_ASSET_CLASS_TARGET) + private List modelAssetClassTarget = null; + + public ModelAssetClassDetails() { + } + + public ModelAssetClassDetails modelAssetClass(ModelAssetClass modelAssetClass) { + + + + + this.modelAssetClass = modelAssetClass; + return this; + } + + /** + * Get modelAssetClass + * @return modelAssetClass + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public ModelAssetClass getModelAssetClass() { + return modelAssetClass; + } + + + public void setModelAssetClass(ModelAssetClass modelAssetClass) { + + + + this.modelAssetClass = modelAssetClass; + } + + + public ModelAssetClassDetails modelAssetClassTarget(List modelAssetClassTarget) { + + + + + this.modelAssetClassTarget = modelAssetClassTarget; + return this; + } + + public ModelAssetClassDetails addModelAssetClassTargetItem(ModelAssetClassTarget modelAssetClassTargetItem) { + if (this.modelAssetClassTarget == null) { + this.modelAssetClassTarget = new ArrayList<>(); + } + this.modelAssetClassTarget.add(modelAssetClassTargetItem); + return this; + } + + /** + * Get modelAssetClassTarget + * @return modelAssetClassTarget + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public List getModelAssetClassTarget() { + return modelAssetClassTarget; + } + + + public void setModelAssetClassTarget(List modelAssetClassTarget) { + + + + this.modelAssetClassTarget = modelAssetClassTarget; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelAssetClassDetails instance itself + */ + public ModelAssetClassDetails putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelAssetClassDetails modelAssetClassDetails = (ModelAssetClassDetails) o; + return Objects.equals(this.modelAssetClass, modelAssetClassDetails.modelAssetClass) && + Objects.equals(this.modelAssetClassTarget, modelAssetClassDetails.modelAssetClassTarget)&& + Objects.equals(this.additionalProperties, modelAssetClassDetails.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(modelAssetClass, modelAssetClassTarget, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelAssetClassDetails {\n"); + sb.append(" modelAssetClass: ").append(toIndentedString(modelAssetClass)).append("\n"); + sb.append(" modelAssetClassTarget: ").append(toIndentedString(modelAssetClassTarget)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("model_asset_class"); + openapiFields.add("model_asset_class_target"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to ModelAssetClassDetails + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!ModelAssetClassDetails.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ModelAssetClassDetails is not found in the empty JSON string", ModelAssetClassDetails.openapiRequiredFields.toString())); + } + } + // validate the optional field `model_asset_class` + if (jsonObj.get("model_asset_class") != null && !jsonObj.get("model_asset_class").isJsonNull()) { + ModelAssetClass.validateJsonObject(jsonObj.getAsJsonObject("model_asset_class")); + } + if (jsonObj.get("model_asset_class_target") != null && !jsonObj.get("model_asset_class_target").isJsonNull()) { + JsonArray jsonArraymodelAssetClassTarget = jsonObj.getAsJsonArray("model_asset_class_target"); + if (jsonArraymodelAssetClassTarget != null) { + // ensure the json data is an array + if (!jsonObj.get("model_asset_class_target").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `model_asset_class_target` to be an array in the JSON string but got `%s`", jsonObj.get("model_asset_class_target").toString())); + } + + // validate the optional field `model_asset_class_target` (array) + for (int i = 0; i < jsonArraymodelAssetClassTarget.size(); i++) { + ModelAssetClassTarget.validateJsonObject(jsonArraymodelAssetClassTarget.get(i).getAsJsonObject()); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModelAssetClassDetails.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModelAssetClassDetails' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModelAssetClassDetails.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModelAssetClassDetails value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ModelAssetClassDetails read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + ModelAssetClassDetails instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModelAssetClassDetails given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModelAssetClassDetails + * @throws IOException if the JSON string is invalid with respect to ModelAssetClassDetails + */ + public static ModelAssetClassDetails fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModelAssetClassDetails.class); + } + + /** + * Convert an instance of ModelAssetClassDetails to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ModelAssetClassTarget.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ModelAssetClassTarget.java new file mode 100644 index 0000000000..7209e515b3 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ModelAssetClassTarget.java @@ -0,0 +1,292 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.UniversalSymbol; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * ModelAssetClassTarget + */@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class ModelAssetClassTarget { + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + @SerializedName(SERIALIZED_NAME_SYMBOL) + private UniversalSymbol symbol; + + public ModelAssetClassTarget() { + } + + public ModelAssetClassTarget symbol(UniversalSymbol symbol) { + + + + + this.symbol = symbol; + return this; + } + + /** + * Get symbol + * @return symbol + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public UniversalSymbol getSymbol() { + return symbol; + } + + + public void setSymbol(UniversalSymbol symbol) { + + + + this.symbol = symbol; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelAssetClassTarget instance itself + */ + public ModelAssetClassTarget putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelAssetClassTarget modelAssetClassTarget = (ModelAssetClassTarget) o; + return Objects.equals(this.symbol, modelAssetClassTarget.symbol)&& + Objects.equals(this.additionalProperties, modelAssetClassTarget.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(symbol, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelAssetClassTarget {\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("symbol"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to ModelAssetClassTarget + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!ModelAssetClassTarget.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ModelAssetClassTarget is not found in the empty JSON string", ModelAssetClassTarget.openapiRequiredFields.toString())); + } + } + // validate the optional field `symbol` + if (jsonObj.get("symbol") != null && !jsonObj.get("symbol").isJsonNull()) { + UniversalSymbol.validateJsonObject(jsonObj.getAsJsonObject("symbol")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModelAssetClassTarget.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModelAssetClassTarget' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModelAssetClassTarget.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModelAssetClassTarget value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ModelAssetClassTarget read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + ModelAssetClassTarget instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModelAssetClassTarget given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModelAssetClassTarget + * @throws IOException if the JSON string is invalid with respect to ModelAssetClassTarget + */ + public static ModelAssetClassTarget fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModelAssetClassTarget.class); + } + + /** + * Convert an instance of ModelAssetClassTarget to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ModelPortfolio.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ModelPortfolio.java new file mode 100644 index 0000000000..ecc6ffe40d --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ModelPortfolio.java @@ -0,0 +1,415 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * ModelPortfolio + */@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class ModelPortfolio { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private UUID id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + /** + * Enum definitions -> [-1: Unassigned, 0: Security Model Portfolio, 1: Asset Class Portfolio] + */ + @JsonAdapter(ModelTypeEnum.Adapter.class) + public enum ModelTypeEnum { + NUMBER_MINUS_1(-1), + + NUMBER_0(0), + + NUMBER_1(1); + + private Integer value; + + ModelTypeEnum(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ModelTypeEnum fromValue(Integer value) { + for (ModelTypeEnum b : ModelTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ModelTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ModelTypeEnum read(final JsonReader jsonReader) throws IOException { + Integer value = jsonReader.nextInt(); + return ModelTypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_MODEL_TYPE = "model_type"; + @SerializedName(SERIALIZED_NAME_MODEL_TYPE) + private ModelTypeEnum modelType = ModelTypeEnum.NUMBER_MINUS_1; + + public ModelPortfolio() { + } + + public ModelPortfolio id(UUID id) { + + + + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getId() { + return id; + } + + + public void setId(UUID id) { + + + + this.id = id; + } + + + public ModelPortfolio name(String name) { + + + + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "SnapTrade 5x Aggressive Growth Fund", value = "") + + public String getName() { + return name; + } + + + public void setName(String name) { + + + + this.name = name; + } + + + public ModelPortfolio modelType(ModelTypeEnum modelType) { + + + + + this.modelType = modelType; + return this; + } + + /** + * Enum definitions -> [-1: Unassigned, 0: Security Model Portfolio, 1: Asset Class Portfolio] + * @return modelType + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "_1", value = "Enum definitions -> [-1: Unassigned, 0: Security Model Portfolio, 1: Asset Class Portfolio]") + + public ModelTypeEnum getModelType() { + return modelType; + } + + + public void setModelType(ModelTypeEnum modelType) { + + + + this.modelType = modelType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelPortfolio instance itself + */ + public ModelPortfolio putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelPortfolio modelPortfolio = (ModelPortfolio) o; + return Objects.equals(this.id, modelPortfolio.id) && + Objects.equals(this.name, modelPortfolio.name) && + Objects.equals(this.modelType, modelPortfolio.modelType)&& + Objects.equals(this.additionalProperties, modelPortfolio.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, modelType, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelPortfolio {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" modelType: ").append(toIndentedString(modelType)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("model_type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to ModelPortfolio + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!ModelPortfolio.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ModelPortfolio is not found in the empty JSON string", ModelPortfolio.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModelPortfolio.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModelPortfolio' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModelPortfolio.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModelPortfolio value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ModelPortfolio read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + ModelPortfolio instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModelPortfolio given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModelPortfolio + * @throws IOException if the JSON string is invalid with respect to ModelPortfolio + */ + public static ModelPortfolio fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModelPortfolio.class); + } + + /** + * Convert an instance of ModelPortfolio to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ModelPortfolioAssetClass.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ModelPortfolioAssetClass.java new file mode 100644 index 0000000000..4916d606ba --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ModelPortfolioAssetClass.java @@ -0,0 +1,338 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.ModelAssetClass; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * ModelPortfolioAssetClass + */@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class ModelPortfolioAssetClass { + public static final String SERIALIZED_NAME_MODEL_ASSET_CLASS = "model_asset_class"; + @SerializedName(SERIALIZED_NAME_MODEL_ASSET_CLASS) + private ModelAssetClass modelAssetClass; + + public static final String SERIALIZED_NAME_PERCENT = "percent"; + @SerializedName(SERIALIZED_NAME_PERCENT) + private Integer percent; + + public ModelPortfolioAssetClass() { + } + + public ModelPortfolioAssetClass modelAssetClass(ModelAssetClass modelAssetClass) { + + + + + this.modelAssetClass = modelAssetClass; + return this; + } + + /** + * Get modelAssetClass + * @return modelAssetClass + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public ModelAssetClass getModelAssetClass() { + return modelAssetClass; + } + + + public void setModelAssetClass(ModelAssetClass modelAssetClass) { + + + + this.modelAssetClass = modelAssetClass; + } + + + public ModelPortfolioAssetClass percent(Integer percent) { + if (percent != null && percent < 0) { + throw new IllegalArgumentException("Invalid value for percent. Must be greater than or equal to 0."); + } + if (percent != null && percent > 100) { + throw new IllegalArgumentException("Invalid value for percent. Must be less than or equal to 100."); + } + + + this.percent = percent; + return this; + } + + /** + * Get percent + * minimum: 0 + * maximum: 100 + * @return percent + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "100", value = "") + + public Integer getPercent() { + return percent; + } + + + public void setPercent(Integer percent) { + if (percent != null && percent < 0) { + throw new IllegalArgumentException("Invalid value for percent. Must be greater than or equal to 0."); + } + if (percent != null && percent > 100) { + throw new IllegalArgumentException("Invalid value for percent. Must be less than or equal to 100."); + } + + this.percent = percent; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelPortfolioAssetClass instance itself + */ + public ModelPortfolioAssetClass putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelPortfolioAssetClass modelPortfolioAssetClass = (ModelPortfolioAssetClass) o; + return Objects.equals(this.modelAssetClass, modelPortfolioAssetClass.modelAssetClass) && + Objects.equals(this.percent, modelPortfolioAssetClass.percent)&& + Objects.equals(this.additionalProperties, modelPortfolioAssetClass.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(modelAssetClass, percent, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelPortfolioAssetClass {\n"); + sb.append(" modelAssetClass: ").append(toIndentedString(modelAssetClass)).append("\n"); + sb.append(" percent: ").append(toIndentedString(percent)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("model_asset_class"); + openapiFields.add("percent"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to ModelPortfolioAssetClass + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!ModelPortfolioAssetClass.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ModelPortfolioAssetClass is not found in the empty JSON string", ModelPortfolioAssetClass.openapiRequiredFields.toString())); + } + } + // validate the optional field `model_asset_class` + if (jsonObj.get("model_asset_class") != null && !jsonObj.get("model_asset_class").isJsonNull()) { + ModelAssetClass.validateJsonObject(jsonObj.getAsJsonObject("model_asset_class")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModelPortfolioAssetClass.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModelPortfolioAssetClass' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModelPortfolioAssetClass.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModelPortfolioAssetClass value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ModelPortfolioAssetClass read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + ModelPortfolioAssetClass instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModelPortfolioAssetClass given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModelPortfolioAssetClass + * @throws IOException if the JSON string is invalid with respect to ModelPortfolioAssetClass + */ + public static ModelPortfolioAssetClass fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModelPortfolioAssetClass.class); + } + + /** + * Convert an instance of ModelPortfolioAssetClass to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ModelPortfolioDetails.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ModelPortfolioDetails.java new file mode 100644 index 0000000000..c026a5a04b --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ModelPortfolioDetails.java @@ -0,0 +1,412 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.ModelPortfolio; +import com.konfigthis.client.model.ModelPortfolioAssetClass; +import com.konfigthis.client.model.ModelPortfolioSecurity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * ModelPortfolioDetails + */@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class ModelPortfolioDetails { + public static final String SERIALIZED_NAME_MODEL_PORTFOLIO = "model_portfolio"; + @SerializedName(SERIALIZED_NAME_MODEL_PORTFOLIO) + private ModelPortfolio modelPortfolio; + + public static final String SERIALIZED_NAME_MODEL_PORTFOLIO_SECURITY = "model_portfolio_security"; + @SerializedName(SERIALIZED_NAME_MODEL_PORTFOLIO_SECURITY) + private List modelPortfolioSecurity = null; + + public static final String SERIALIZED_NAME_MODEL_PORTFOLIO_ASSET_CLASS = "model_portfolio_asset_class"; + @SerializedName(SERIALIZED_NAME_MODEL_PORTFOLIO_ASSET_CLASS) + private List modelPortfolioAssetClass = null; + + public ModelPortfolioDetails() { + } + + public ModelPortfolioDetails modelPortfolio(ModelPortfolio modelPortfolio) { + + + + + this.modelPortfolio = modelPortfolio; + return this; + } + + /** + * Get modelPortfolio + * @return modelPortfolio + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public ModelPortfolio getModelPortfolio() { + return modelPortfolio; + } + + + public void setModelPortfolio(ModelPortfolio modelPortfolio) { + + + + this.modelPortfolio = modelPortfolio; + } + + + public ModelPortfolioDetails modelPortfolioSecurity(List modelPortfolioSecurity) { + + + + + this.modelPortfolioSecurity = modelPortfolioSecurity; + return this; + } + + public ModelPortfolioDetails addModelPortfolioSecurityItem(ModelPortfolioSecurity modelPortfolioSecurityItem) { + if (this.modelPortfolioSecurity == null) { + this.modelPortfolioSecurity = new ArrayList<>(); + } + this.modelPortfolioSecurity.add(modelPortfolioSecurityItem); + return this; + } + + /** + * Get modelPortfolioSecurity + * @return modelPortfolioSecurity + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public List getModelPortfolioSecurity() { + return modelPortfolioSecurity; + } + + + public void setModelPortfolioSecurity(List modelPortfolioSecurity) { + + + + this.modelPortfolioSecurity = modelPortfolioSecurity; + } + + + public ModelPortfolioDetails modelPortfolioAssetClass(List modelPortfolioAssetClass) { + + + + + this.modelPortfolioAssetClass = modelPortfolioAssetClass; + return this; + } + + public ModelPortfolioDetails addModelPortfolioAssetClassItem(ModelPortfolioAssetClass modelPortfolioAssetClassItem) { + if (this.modelPortfolioAssetClass == null) { + this.modelPortfolioAssetClass = new ArrayList<>(); + } + this.modelPortfolioAssetClass.add(modelPortfolioAssetClassItem); + return this; + } + + /** + * Get modelPortfolioAssetClass + * @return modelPortfolioAssetClass + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public List getModelPortfolioAssetClass() { + return modelPortfolioAssetClass; + } + + + public void setModelPortfolioAssetClass(List modelPortfolioAssetClass) { + + + + this.modelPortfolioAssetClass = modelPortfolioAssetClass; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelPortfolioDetails instance itself + */ + public ModelPortfolioDetails putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelPortfolioDetails modelPortfolioDetails = (ModelPortfolioDetails) o; + return Objects.equals(this.modelPortfolio, modelPortfolioDetails.modelPortfolio) && + Objects.equals(this.modelPortfolioSecurity, modelPortfolioDetails.modelPortfolioSecurity) && + Objects.equals(this.modelPortfolioAssetClass, modelPortfolioDetails.modelPortfolioAssetClass)&& + Objects.equals(this.additionalProperties, modelPortfolioDetails.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(modelPortfolio, modelPortfolioSecurity, modelPortfolioAssetClass, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelPortfolioDetails {\n"); + sb.append(" modelPortfolio: ").append(toIndentedString(modelPortfolio)).append("\n"); + sb.append(" modelPortfolioSecurity: ").append(toIndentedString(modelPortfolioSecurity)).append("\n"); + sb.append(" modelPortfolioAssetClass: ").append(toIndentedString(modelPortfolioAssetClass)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("model_portfolio"); + openapiFields.add("model_portfolio_security"); + openapiFields.add("model_portfolio_asset_class"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to ModelPortfolioDetails + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!ModelPortfolioDetails.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ModelPortfolioDetails is not found in the empty JSON string", ModelPortfolioDetails.openapiRequiredFields.toString())); + } + } + // validate the optional field `model_portfolio` + if (jsonObj.get("model_portfolio") != null && !jsonObj.get("model_portfolio").isJsonNull()) { + ModelPortfolio.validateJsonObject(jsonObj.getAsJsonObject("model_portfolio")); + } + if (jsonObj.get("model_portfolio_security") != null && !jsonObj.get("model_portfolio_security").isJsonNull()) { + JsonArray jsonArraymodelPortfolioSecurity = jsonObj.getAsJsonArray("model_portfolio_security"); + if (jsonArraymodelPortfolioSecurity != null) { + // ensure the json data is an array + if (!jsonObj.get("model_portfolio_security").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `model_portfolio_security` to be an array in the JSON string but got `%s`", jsonObj.get("model_portfolio_security").toString())); + } + + // validate the optional field `model_portfolio_security` (array) + for (int i = 0; i < jsonArraymodelPortfolioSecurity.size(); i++) { + ModelPortfolioSecurity.validateJsonObject(jsonArraymodelPortfolioSecurity.get(i).getAsJsonObject()); + }; + } + } + if (jsonObj.get("model_portfolio_asset_class") != null && !jsonObj.get("model_portfolio_asset_class").isJsonNull()) { + JsonArray jsonArraymodelPortfolioAssetClass = jsonObj.getAsJsonArray("model_portfolio_asset_class"); + if (jsonArraymodelPortfolioAssetClass != null) { + // ensure the json data is an array + if (!jsonObj.get("model_portfolio_asset_class").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `model_portfolio_asset_class` to be an array in the JSON string but got `%s`", jsonObj.get("model_portfolio_asset_class").toString())); + } + + // validate the optional field `model_portfolio_asset_class` (array) + for (int i = 0; i < jsonArraymodelPortfolioAssetClass.size(); i++) { + ModelPortfolioAssetClass.validateJsonObject(jsonArraymodelPortfolioAssetClass.get(i).getAsJsonObject()); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModelPortfolioDetails.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModelPortfolioDetails' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModelPortfolioDetails.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModelPortfolioDetails value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ModelPortfolioDetails read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + ModelPortfolioDetails instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModelPortfolioDetails given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModelPortfolioDetails + * @throws IOException if the JSON string is invalid with respect to ModelPortfolioDetails + */ + public static ModelPortfolioDetails fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModelPortfolioDetails.class); + } + + /** + * Convert an instance of ModelPortfolioDetails to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ModelPortfolioSecurity.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ModelPortfolioSecurity.java new file mode 100644 index 0000000000..3934fd084b --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ModelPortfolioSecurity.java @@ -0,0 +1,338 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.UniversalSymbol; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * ModelPortfolioSecurity + */@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class ModelPortfolioSecurity { + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + @SerializedName(SERIALIZED_NAME_SYMBOL) + private UniversalSymbol symbol; + + public static final String SERIALIZED_NAME_PERCENT = "percent"; + @SerializedName(SERIALIZED_NAME_PERCENT) + private Integer percent; + + public ModelPortfolioSecurity() { + } + + public ModelPortfolioSecurity symbol(UniversalSymbol symbol) { + + + + + this.symbol = symbol; + return this; + } + + /** + * Get symbol + * @return symbol + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public UniversalSymbol getSymbol() { + return symbol; + } + + + public void setSymbol(UniversalSymbol symbol) { + + + + this.symbol = symbol; + } + + + public ModelPortfolioSecurity percent(Integer percent) { + if (percent != null && percent < 0) { + throw new IllegalArgumentException("Invalid value for percent. Must be greater than or equal to 0."); + } + if (percent != null && percent > 100) { + throw new IllegalArgumentException("Invalid value for percent. Must be less than or equal to 100."); + } + + + this.percent = percent; + return this; + } + + /** + * Get percent + * minimum: 0 + * maximum: 100 + * @return percent + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "100", value = "") + + public Integer getPercent() { + return percent; + } + + + public void setPercent(Integer percent) { + if (percent != null && percent < 0) { + throw new IllegalArgumentException("Invalid value for percent. Must be greater than or equal to 0."); + } + if (percent != null && percent > 100) { + throw new IllegalArgumentException("Invalid value for percent. Must be less than or equal to 100."); + } + + this.percent = percent; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelPortfolioSecurity instance itself + */ + public ModelPortfolioSecurity putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelPortfolioSecurity modelPortfolioSecurity = (ModelPortfolioSecurity) o; + return Objects.equals(this.symbol, modelPortfolioSecurity.symbol) && + Objects.equals(this.percent, modelPortfolioSecurity.percent)&& + Objects.equals(this.additionalProperties, modelPortfolioSecurity.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(symbol, percent, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelPortfolioSecurity {\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" percent: ").append(toIndentedString(percent)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("symbol"); + openapiFields.add("percent"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to ModelPortfolioSecurity + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!ModelPortfolioSecurity.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ModelPortfolioSecurity is not found in the empty JSON string", ModelPortfolioSecurity.openapiRequiredFields.toString())); + } + } + // validate the optional field `symbol` + if (jsonObj.get("symbol") != null && !jsonObj.get("symbol").isJsonNull()) { + UniversalSymbol.validateJsonObject(jsonObj.getAsJsonObject("symbol")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModelPortfolioSecurity.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModelPortfolioSecurity' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModelPortfolioSecurity.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModelPortfolioSecurity value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ModelPortfolioSecurity read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + ModelPortfolioSecurity instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModelPortfolioSecurity given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModelPortfolioSecurity + * @throws IOException if the JSON string is invalid with respect to ModelPortfolioSecurity + */ + public static ModelPortfolioSecurity fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModelPortfolioSecurity.class); + } + + /** + * Convert an instance of ModelPortfolioSecurity to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/MonthlyDividends.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/MonthlyDividends.java new file mode 100644 index 0000000000..dc88dc9da4 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/MonthlyDividends.java @@ -0,0 +1,349 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.DividendAtDate; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * MonthlyDividends + */@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class MonthlyDividends { + public static final String SERIALIZED_NAME_DATE = "date"; + @SerializedName(SERIALIZED_NAME_DATE) + private LocalDate date; + + public static final String SERIALIZED_NAME_DIVIDENDS = "dividends"; + @SerializedName(SERIALIZED_NAME_DIVIDENDS) + private List dividends = null; + + public MonthlyDividends() { + } + + public MonthlyDividends date(LocalDate date) { + + + + + this.date = date; + return this; + } + + /** + * Date used to specify timeframe for a reporting call (in YYYY-MM-DD format) + * @return date + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Sun Jan 23 16:00:00 PST 2022", value = "Date used to specify timeframe for a reporting call (in YYYY-MM-DD format)") + + public LocalDate getDate() { + return date; + } + + + public void setDate(LocalDate date) { + + + + this.date = date; + } + + + public MonthlyDividends dividends(List dividends) { + + + + + this.dividends = dividends; + return this; + } + + public MonthlyDividends addDividendsItem(DividendAtDate dividendsItem) { + if (this.dividends == null) { + this.dividends = new ArrayList<>(); + } + this.dividends.add(dividendsItem); + return this; + } + + /** + * Get dividends + * @return dividends + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public List getDividends() { + return dividends; + } + + + public void setDividends(List dividends) { + + + + this.dividends = dividends; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MonthlyDividends instance itself + */ + public MonthlyDividends putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MonthlyDividends monthlyDividends = (MonthlyDividends) o; + return Objects.equals(this.date, monthlyDividends.date) && + Objects.equals(this.dividends, monthlyDividends.dividends)&& + Objects.equals(this.additionalProperties, monthlyDividends.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(date, dividends, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MonthlyDividends {\n"); + sb.append(" date: ").append(toIndentedString(date)).append("\n"); + sb.append(" dividends: ").append(toIndentedString(dividends)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("date"); + openapiFields.add("dividends"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to MonthlyDividends + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!MonthlyDividends.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MonthlyDividends is not found in the empty JSON string", MonthlyDividends.openapiRequiredFields.toString())); + } + } + if (jsonObj.get("dividends") != null && !jsonObj.get("dividends").isJsonNull()) { + JsonArray jsonArraydividends = jsonObj.getAsJsonArray("dividends"); + if (jsonArraydividends != null) { + // ensure the json data is an array + if (!jsonObj.get("dividends").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `dividends` to be an array in the JSON string but got `%s`", jsonObj.get("dividends").toString())); + } + + // validate the optional field `dividends` (array) + for (int i = 0; i < jsonArraydividends.size(); i++) { + DividendAtDate.validateJsonObject(jsonArraydividends.get(i).getAsJsonObject()); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MonthlyDividends.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MonthlyDividends' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MonthlyDividends.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MonthlyDividends value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public MonthlyDividends read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + MonthlyDividends instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MonthlyDividends given an JSON string + * + * @param jsonString JSON string + * @return An instance of MonthlyDividends + * @throws IOException if the JSON string is invalid with respect to MonthlyDividends + */ + public static MonthlyDividends fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MonthlyDividends.class); + } + + /** + * Convert an instance of MonthlyDividends to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/NetContributions.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/NetContributions.java new file mode 100644 index 0000000000..bc27a553c5 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/NetContributions.java @@ -0,0 +1,384 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.time.LocalDate; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * NetContributions + */@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class NetContributions { + public static final String SERIALIZED_NAME_DATE = "date"; + @SerializedName(SERIALIZED_NAME_DATE) + private LocalDate date; + + public static final String SERIALIZED_NAME_CONTRIBUTIONS = "contributions"; + @SerializedName(SERIALIZED_NAME_CONTRIBUTIONS) + private Double contributions; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + private String currency; + + public NetContributions() { + } + + public NetContributions date(LocalDate date) { + + + + + this.date = date; + return this; + } + + /** + * Date used to specify timeframe for a reporting call (in YYYY-MM-DD format) + * @return date + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Sun Jan 23 16:00:00 PST 2022", value = "Date used to specify timeframe for a reporting call (in YYYY-MM-DD format)") + + public LocalDate getDate() { + return date; + } + + + public void setDate(LocalDate date) { + + + + this.date = date; + } + + + public NetContributions contributions(Double contributions) { + + + + + this.contributions = contributions; + return this; + } + + public NetContributions contributions(Integer contributions) { + + + + + this.contributions = contributions.doubleValue(); + return this; + } + + /** + * Get contributions + * @return contributions + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "524.74", value = "") + + public Double getContributions() { + return contributions; + } + + + public void setContributions(Double contributions) { + + + + this.contributions = contributions; + } + + + public NetContributions currency(String currency) { + + + + + this.currency = currency; + return this; + } + + /** + * Get currency + * @return currency + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "CAD", value = "") + + public String getCurrency() { + return currency; + } + + + public void setCurrency(String currency) { + + + + this.currency = currency; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NetContributions instance itself + */ + public NetContributions putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NetContributions netContributions = (NetContributions) o; + return Objects.equals(this.date, netContributions.date) && + Objects.equals(this.contributions, netContributions.contributions) && + Objects.equals(this.currency, netContributions.currency)&& + Objects.equals(this.additionalProperties, netContributions.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(date, contributions, currency, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NetContributions {\n"); + sb.append(" date: ").append(toIndentedString(date)).append("\n"); + sb.append(" contributions: ").append(toIndentedString(contributions)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("date"); + openapiFields.add("contributions"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to NetContributions + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!NetContributions.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in NetContributions is not found in the empty JSON string", NetContributions.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) && !jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NetContributions.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NetContributions' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(NetContributions.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, NetContributions value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public NetContributions read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + NetContributions instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of NetContributions given an JSON string + * + * @param jsonString JSON string + * @return An instance of NetContributions + * @throws IOException if the JSON string is invalid with respect to NetContributions + */ + public static NetContributions fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NetContributions.class); + } + + /** + * Convert an instance of NetContributions to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/NetDividend.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/NetDividend.java new file mode 100644 index 0000000000..6795950bea --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/NetDividend.java @@ -0,0 +1,389 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.UniversalSymbol; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Object representing total dividends received during a timeframe + */ +@ApiModel(description = "Object representing total dividends received during a timeframe")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class NetDividend { + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + @SerializedName(SERIALIZED_NAME_SYMBOL) + private UniversalSymbol symbol; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Double amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + private String currency; + + public NetDividend() { + } + + public NetDividend symbol(UniversalSymbol symbol) { + + + + + this.symbol = symbol; + return this; + } + + /** + * Get symbol + * @return symbol + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public UniversalSymbol getSymbol() { + return symbol; + } + + + public void setSymbol(UniversalSymbol symbol) { + + + + this.symbol = symbol; + } + + + public NetDividend amount(Double amount) { + + + + + this.amount = amount; + return this; + } + + public NetDividend amount(Integer amount) { + + + + + this.amount = amount.doubleValue(); + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "165.05", value = "") + + public Double getAmount() { + return amount; + } + + + public void setAmount(Double amount) { + + + + this.amount = amount; + } + + + public NetDividend currency(String currency) { + + + + + this.currency = currency; + return this; + } + + /** + * Get currency + * @return currency + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "USD", value = "") + + public String getCurrency() { + return currency; + } + + + public void setCurrency(String currency) { + + + + this.currency = currency; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NetDividend instance itself + */ + public NetDividend putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NetDividend netDividend = (NetDividend) o; + return Objects.equals(this.symbol, netDividend.symbol) && + Objects.equals(this.amount, netDividend.amount) && + Objects.equals(this.currency, netDividend.currency)&& + Objects.equals(this.additionalProperties, netDividend.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(symbol, amount, currency, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NetDividend {\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("symbol"); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to NetDividend + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!NetDividend.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in NetDividend is not found in the empty JSON string", NetDividend.openapiRequiredFields.toString())); + } + } + // validate the optional field `symbol` + if (jsonObj.get("symbol") != null && !jsonObj.get("symbol").isJsonNull()) { + UniversalSymbol.validateJsonObject(jsonObj.getAsJsonObject("symbol")); + } + if ((jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) && !jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NetDividend.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NetDividend' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(NetDividend.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, NetDividend value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public NetDividend read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + NetDividend instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of NetDividend given an JSON string + * + * @param jsonString JSON string + * @return An instance of NetDividend + * @throws IOException if the JSON string is invalid with respect to NetDividend + */ + public static NetDividend fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NetDividend.class); + } + + /** + * Convert an instance of NetDividend to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/OptionBrokerageSymbol.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/OptionBrokerageSymbol.java new file mode 100644 index 0000000000..acf9ce9a3b --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/OptionBrokerageSymbol.java @@ -0,0 +1,372 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.OptionsSymbol; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Option Brokerage symbol + */ +@ApiModel(description = "Option Brokerage symbol")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class OptionBrokerageSymbol { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private UUID id; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_OPTION_SYMBOL = "option_symbol"; + @SerializedName(SERIALIZED_NAME_OPTION_SYMBOL) + private OptionsSymbol optionSymbol; + + public OptionBrokerageSymbol() { + } + + public OptionBrokerageSymbol id(UUID id) { + + + + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getId() { + return id; + } + + + public void setId(UUID id) { + + + + this.id = id; + } + + + public OptionBrokerageSymbol description(String description) { + + + + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "SPY CALL 7/17 200", value = "") + + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + + + + this.description = description; + } + + + public OptionBrokerageSymbol optionSymbol(OptionsSymbol optionSymbol) { + + + + + this.optionSymbol = optionSymbol; + return this; + } + + /** + * Get optionSymbol + * @return optionSymbol + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public OptionsSymbol getOptionSymbol() { + return optionSymbol; + } + + + public void setOptionSymbol(OptionsSymbol optionSymbol) { + + + + this.optionSymbol = optionSymbol; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the OptionBrokerageSymbol instance itself + */ + public OptionBrokerageSymbol putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OptionBrokerageSymbol optionBrokerageSymbol = (OptionBrokerageSymbol) o; + return Objects.equals(this.id, optionBrokerageSymbol.id) && + Objects.equals(this.description, optionBrokerageSymbol.description) && + Objects.equals(this.optionSymbol, optionBrokerageSymbol.optionSymbol)&& + Objects.equals(this.additionalProperties, optionBrokerageSymbol.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, description, optionSymbol, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OptionBrokerageSymbol {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" optionSymbol: ").append(toIndentedString(optionSymbol)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("description"); + openapiFields.add("option_symbol"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to OptionBrokerageSymbol + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!OptionBrokerageSymbol.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OptionBrokerageSymbol is not found in the empty JSON string", OptionBrokerageSymbol.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + // validate the optional field `option_symbol` + if (jsonObj.get("option_symbol") != null && !jsonObj.get("option_symbol").isJsonNull()) { + OptionsSymbol.validateJsonObject(jsonObj.getAsJsonObject("option_symbol")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OptionBrokerageSymbol.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OptionBrokerageSymbol' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OptionBrokerageSymbol.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OptionBrokerageSymbol value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public OptionBrokerageSymbol read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + OptionBrokerageSymbol instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OptionBrokerageSymbol given an JSON string + * + * @param jsonString JSON string + * @return An instance of OptionBrokerageSymbol + * @throws IOException if the JSON string is invalid with respect to OptionBrokerageSymbol + */ + public static OptionBrokerageSymbol fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OptionBrokerageSymbol.class); + } + + /** + * Convert an instance of OptionBrokerageSymbol to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/OptionChainInner.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/OptionChainInner.java new file mode 100644 index 0000000000..200ca24418 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/OptionChainInner.java @@ -0,0 +1,468 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.OptionChainInnerChainPerRootInner; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * OptionChainInner + */@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class OptionChainInner { + public static final String SERIALIZED_NAME_EXPIRY_DATE = "expiryDate"; + @SerializedName(SERIALIZED_NAME_EXPIRY_DATE) + private String expiryDate; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_LISTING_EXCHANGE = "listingExchange"; + @SerializedName(SERIALIZED_NAME_LISTING_EXCHANGE) + private String listingExchange; + + public static final String SERIALIZED_NAME_OPTION_EXERCISE_TYPE = "optionExerciseType"; + @SerializedName(SERIALIZED_NAME_OPTION_EXERCISE_TYPE) + private String optionExerciseType; + + public static final String SERIALIZED_NAME_CHAIN_PER_ROOT = "chainPerRoot"; + @SerializedName(SERIALIZED_NAME_CHAIN_PER_ROOT) + private List chainPerRoot = null; + + public OptionChainInner() { + } + + public OptionChainInner expiryDate(String expiryDate) { + + + + + this.expiryDate = expiryDate; + return this; + } + + /** + * Get expiryDate + * @return expiryDate + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2022-07-08T04:00:00.000Z", value = "") + + public String getExpiryDate() { + return expiryDate; + } + + + public void setExpiryDate(String expiryDate) { + + + + this.expiryDate = expiryDate; + } + + + public OptionChainInner description(String description) { + + + + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "APPLE INC", value = "") + + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + + + + this.description = description; + } + + + public OptionChainInner listingExchange(String listingExchange) { + + + + + this.listingExchange = listingExchange; + return this; + } + + /** + * Get listingExchange + * @return listingExchange + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "OPRA", value = "") + + public String getListingExchange() { + return listingExchange; + } + + + public void setListingExchange(String listingExchange) { + + + + this.listingExchange = listingExchange; + } + + + public OptionChainInner optionExerciseType(String optionExerciseType) { + + + + + this.optionExerciseType = optionExerciseType; + return this; + } + + /** + * Get optionExerciseType + * @return optionExerciseType + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "American", value = "") + + public String getOptionExerciseType() { + return optionExerciseType; + } + + + public void setOptionExerciseType(String optionExerciseType) { + + + + this.optionExerciseType = optionExerciseType; + } + + + public OptionChainInner chainPerRoot(List chainPerRoot) { + + + + + this.chainPerRoot = chainPerRoot; + return this; + } + + public OptionChainInner addChainPerRootItem(OptionChainInnerChainPerRootInner chainPerRootItem) { + if (this.chainPerRoot == null) { + this.chainPerRoot = new ArrayList<>(); + } + this.chainPerRoot.add(chainPerRootItem); + return this; + } + + /** + * Get chainPerRoot + * @return chainPerRoot + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public List getChainPerRoot() { + return chainPerRoot; + } + + + public void setChainPerRoot(List chainPerRoot) { + + + + this.chainPerRoot = chainPerRoot; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the OptionChainInner instance itself + */ + public OptionChainInner putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OptionChainInner optionChainInner = (OptionChainInner) o; + return Objects.equals(this.expiryDate, optionChainInner.expiryDate) && + Objects.equals(this.description, optionChainInner.description) && + Objects.equals(this.listingExchange, optionChainInner.listingExchange) && + Objects.equals(this.optionExerciseType, optionChainInner.optionExerciseType) && + Objects.equals(this.chainPerRoot, optionChainInner.chainPerRoot)&& + Objects.equals(this.additionalProperties, optionChainInner.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(expiryDate, description, listingExchange, optionExerciseType, chainPerRoot, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OptionChainInner {\n"); + sb.append(" expiryDate: ").append(toIndentedString(expiryDate)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" listingExchange: ").append(toIndentedString(listingExchange)).append("\n"); + sb.append(" optionExerciseType: ").append(toIndentedString(optionExerciseType)).append("\n"); + sb.append(" chainPerRoot: ").append(toIndentedString(chainPerRoot)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("expiryDate"); + openapiFields.add("description"); + openapiFields.add("listingExchange"); + openapiFields.add("optionExerciseType"); + openapiFields.add("chainPerRoot"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to OptionChainInner + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!OptionChainInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OptionChainInner is not found in the empty JSON string", OptionChainInner.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("expiryDate") != null && !jsonObj.get("expiryDate").isJsonNull()) && !jsonObj.get("expiryDate").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `expiryDate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("expiryDate").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if ((jsonObj.get("listingExchange") != null && !jsonObj.get("listingExchange").isJsonNull()) && !jsonObj.get("listingExchange").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `listingExchange` to be a primitive type in the JSON string but got `%s`", jsonObj.get("listingExchange").toString())); + } + if ((jsonObj.get("optionExerciseType") != null && !jsonObj.get("optionExerciseType").isJsonNull()) && !jsonObj.get("optionExerciseType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `optionExerciseType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("optionExerciseType").toString())); + } + if (jsonObj.get("chainPerRoot") != null && !jsonObj.get("chainPerRoot").isJsonNull()) { + JsonArray jsonArraychainPerRoot = jsonObj.getAsJsonArray("chainPerRoot"); + if (jsonArraychainPerRoot != null) { + // ensure the json data is an array + if (!jsonObj.get("chainPerRoot").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `chainPerRoot` to be an array in the JSON string but got `%s`", jsonObj.get("chainPerRoot").toString())); + } + + // validate the optional field `chainPerRoot` (array) + for (int i = 0; i < jsonArraychainPerRoot.size(); i++) { + OptionChainInnerChainPerRootInner.validateJsonObject(jsonArraychainPerRoot.get(i).getAsJsonObject()); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OptionChainInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OptionChainInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OptionChainInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OptionChainInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public OptionChainInner read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + OptionChainInner instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OptionChainInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of OptionChainInner + * @throws IOException if the JSON string is invalid with respect to OptionChainInner + */ + public static OptionChainInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OptionChainInner.class); + } + + /** + * Convert an instance of OptionChainInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/OptionChainInnerChainPerRootInner.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/OptionChainInnerChainPerRootInner.java new file mode 100644 index 0000000000..3fad2bc9e1 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/OptionChainInnerChainPerRootInner.java @@ -0,0 +1,387 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.OptionChainInnerChainPerRootInnerChainPerStrikePriceInner; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * OptionChainInnerChainPerRootInner + */@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class OptionChainInnerChainPerRootInner { + public static final String SERIALIZED_NAME_OPTION_ROOT = "optionRoot"; + @SerializedName(SERIALIZED_NAME_OPTION_ROOT) + private String optionRoot; + + public static final String SERIALIZED_NAME_CHAIN_PER_STRIKE_PRICE = "chainPerStrikePrice"; + @SerializedName(SERIALIZED_NAME_CHAIN_PER_STRIKE_PRICE) + private List chainPerStrikePrice = null; + + public static final String SERIALIZED_NAME_MULTIPLIER = "multiplier"; + @SerializedName(SERIALIZED_NAME_MULTIPLIER) + private Integer multiplier; + + public OptionChainInnerChainPerRootInner() { + } + + public OptionChainInnerChainPerRootInner optionRoot(String optionRoot) { + + + + + this.optionRoot = optionRoot; + return this; + } + + /** + * Get optionRoot + * @return optionRoot + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "AAPL", value = "") + + public String getOptionRoot() { + return optionRoot; + } + + + public void setOptionRoot(String optionRoot) { + + + + this.optionRoot = optionRoot; + } + + + public OptionChainInnerChainPerRootInner chainPerStrikePrice(List chainPerStrikePrice) { + + + + + this.chainPerStrikePrice = chainPerStrikePrice; + return this; + } + + public OptionChainInnerChainPerRootInner addChainPerStrikePriceItem(OptionChainInnerChainPerRootInnerChainPerStrikePriceInner chainPerStrikePriceItem) { + if (this.chainPerStrikePrice == null) { + this.chainPerStrikePrice = new ArrayList<>(); + } + this.chainPerStrikePrice.add(chainPerStrikePriceItem); + return this; + } + + /** + * Get chainPerStrikePrice + * @return chainPerStrikePrice + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public List getChainPerStrikePrice() { + return chainPerStrikePrice; + } + + + public void setChainPerStrikePrice(List chainPerStrikePrice) { + + + + this.chainPerStrikePrice = chainPerStrikePrice; + } + + + public OptionChainInnerChainPerRootInner multiplier(Integer multiplier) { + + + + + this.multiplier = multiplier; + return this; + } + + /** + * Get multiplier + * @return multiplier + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "100", value = "") + + public Integer getMultiplier() { + return multiplier; + } + + + public void setMultiplier(Integer multiplier) { + + + + this.multiplier = multiplier; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the OptionChainInnerChainPerRootInner instance itself + */ + public OptionChainInnerChainPerRootInner putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OptionChainInnerChainPerRootInner optionChainInnerChainPerRootInner = (OptionChainInnerChainPerRootInner) o; + return Objects.equals(this.optionRoot, optionChainInnerChainPerRootInner.optionRoot) && + Objects.equals(this.chainPerStrikePrice, optionChainInnerChainPerRootInner.chainPerStrikePrice) && + Objects.equals(this.multiplier, optionChainInnerChainPerRootInner.multiplier)&& + Objects.equals(this.additionalProperties, optionChainInnerChainPerRootInner.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(optionRoot, chainPerStrikePrice, multiplier, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OptionChainInnerChainPerRootInner {\n"); + sb.append(" optionRoot: ").append(toIndentedString(optionRoot)).append("\n"); + sb.append(" chainPerStrikePrice: ").append(toIndentedString(chainPerStrikePrice)).append("\n"); + sb.append(" multiplier: ").append(toIndentedString(multiplier)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("optionRoot"); + openapiFields.add("chainPerStrikePrice"); + openapiFields.add("multiplier"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to OptionChainInnerChainPerRootInner + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!OptionChainInnerChainPerRootInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OptionChainInnerChainPerRootInner is not found in the empty JSON string", OptionChainInnerChainPerRootInner.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("optionRoot") != null && !jsonObj.get("optionRoot").isJsonNull()) && !jsonObj.get("optionRoot").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `optionRoot` to be a primitive type in the JSON string but got `%s`", jsonObj.get("optionRoot").toString())); + } + if (jsonObj.get("chainPerStrikePrice") != null && !jsonObj.get("chainPerStrikePrice").isJsonNull()) { + JsonArray jsonArraychainPerStrikePrice = jsonObj.getAsJsonArray("chainPerStrikePrice"); + if (jsonArraychainPerStrikePrice != null) { + // ensure the json data is an array + if (!jsonObj.get("chainPerStrikePrice").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `chainPerStrikePrice` to be an array in the JSON string but got `%s`", jsonObj.get("chainPerStrikePrice").toString())); + } + + // validate the optional field `chainPerStrikePrice` (array) + for (int i = 0; i < jsonArraychainPerStrikePrice.size(); i++) { + OptionChainInnerChainPerRootInnerChainPerStrikePriceInner.validateJsonObject(jsonArraychainPerStrikePrice.get(i).getAsJsonObject()); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OptionChainInnerChainPerRootInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OptionChainInnerChainPerRootInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OptionChainInnerChainPerRootInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OptionChainInnerChainPerRootInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public OptionChainInnerChainPerRootInner read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + OptionChainInnerChainPerRootInner instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OptionChainInnerChainPerRootInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of OptionChainInnerChainPerRootInner + * @throws IOException if the JSON string is invalid with respect to OptionChainInnerChainPerRootInner + */ + public static OptionChainInnerChainPerRootInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OptionChainInnerChainPerRootInner.class); + } + + /** + * Convert an instance of OptionChainInnerChainPerRootInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/OptionChainInnerChainPerRootInnerChainPerStrikePriceInner.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/OptionChainInnerChainPerRootInnerChainPerStrikePriceInner.java new file mode 100644 index 0000000000..6446b7e3a9 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/OptionChainInnerChainPerRootInnerChainPerStrikePriceInner.java @@ -0,0 +1,371 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * OptionChainInnerChainPerRootInnerChainPerStrikePriceInner + */@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class OptionChainInnerChainPerRootInnerChainPerStrikePriceInner { + public static final String SERIALIZED_NAME_STRIKE_PRICE = "strikePrice"; + @SerializedName(SERIALIZED_NAME_STRIKE_PRICE) + private Integer strikePrice; + + public static final String SERIALIZED_NAME_CALL_SYMBOL_ID = "callSymbolId"; + @SerializedName(SERIALIZED_NAME_CALL_SYMBOL_ID) + private Integer callSymbolId; + + public static final String SERIALIZED_NAME_PUT_SYMBOL_ID = "putSymbolId"; + @SerializedName(SERIALIZED_NAME_PUT_SYMBOL_ID) + private Integer putSymbolId; + + public OptionChainInnerChainPerRootInnerChainPerStrikePriceInner() { + } + + public OptionChainInnerChainPerRootInnerChainPerStrikePriceInner strikePrice(Integer strikePrice) { + + + + + this.strikePrice = strikePrice; + return this; + } + + /** + * Get strikePrice + * @return strikePrice + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "70", value = "") + + public Integer getStrikePrice() { + return strikePrice; + } + + + public void setStrikePrice(Integer strikePrice) { + + + + this.strikePrice = strikePrice; + } + + + public OptionChainInnerChainPerRootInnerChainPerStrikePriceInner callSymbolId(Integer callSymbolId) { + + + + + this.callSymbolId = callSymbolId; + return this; + } + + /** + * Get callSymbolId + * @return callSymbolId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "42816081", value = "") + + public Integer getCallSymbolId() { + return callSymbolId; + } + + + public void setCallSymbolId(Integer callSymbolId) { + + + + this.callSymbolId = callSymbolId; + } + + + public OptionChainInnerChainPerRootInnerChainPerStrikePriceInner putSymbolId(Integer putSymbolId) { + + + + + this.putSymbolId = putSymbolId; + return this; + } + + /** + * Get putSymbolId + * @return putSymbolId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "42816129", value = "") + + public Integer getPutSymbolId() { + return putSymbolId; + } + + + public void setPutSymbolId(Integer putSymbolId) { + + + + this.putSymbolId = putSymbolId; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the OptionChainInnerChainPerRootInnerChainPerStrikePriceInner instance itself + */ + public OptionChainInnerChainPerRootInnerChainPerStrikePriceInner putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OptionChainInnerChainPerRootInnerChainPerStrikePriceInner optionChainInnerChainPerRootInnerChainPerStrikePriceInner = (OptionChainInnerChainPerRootInnerChainPerStrikePriceInner) o; + return Objects.equals(this.strikePrice, optionChainInnerChainPerRootInnerChainPerStrikePriceInner.strikePrice) && + Objects.equals(this.callSymbolId, optionChainInnerChainPerRootInnerChainPerStrikePriceInner.callSymbolId) && + Objects.equals(this.putSymbolId, optionChainInnerChainPerRootInnerChainPerStrikePriceInner.putSymbolId)&& + Objects.equals(this.additionalProperties, optionChainInnerChainPerRootInnerChainPerStrikePriceInner.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(strikePrice, callSymbolId, putSymbolId, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OptionChainInnerChainPerRootInnerChainPerStrikePriceInner {\n"); + sb.append(" strikePrice: ").append(toIndentedString(strikePrice)).append("\n"); + sb.append(" callSymbolId: ").append(toIndentedString(callSymbolId)).append("\n"); + sb.append(" putSymbolId: ").append(toIndentedString(putSymbolId)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("strikePrice"); + openapiFields.add("callSymbolId"); + openapiFields.add("putSymbolId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to OptionChainInnerChainPerRootInnerChainPerStrikePriceInner + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!OptionChainInnerChainPerRootInnerChainPerStrikePriceInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OptionChainInnerChainPerRootInnerChainPerStrikePriceInner is not found in the empty JSON string", OptionChainInnerChainPerRootInnerChainPerStrikePriceInner.openapiRequiredFields.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OptionChainInnerChainPerRootInnerChainPerStrikePriceInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OptionChainInnerChainPerRootInnerChainPerStrikePriceInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OptionChainInnerChainPerRootInnerChainPerStrikePriceInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OptionChainInnerChainPerRootInnerChainPerStrikePriceInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public OptionChainInnerChainPerRootInnerChainPerStrikePriceInner read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + OptionChainInnerChainPerRootInnerChainPerStrikePriceInner instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OptionChainInnerChainPerRootInnerChainPerStrikePriceInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of OptionChainInnerChainPerRootInnerChainPerStrikePriceInner + * @throws IOException if the JSON string is invalid with respect to OptionChainInnerChainPerRootInnerChainPerStrikePriceInner + */ + public static OptionChainInnerChainPerRootInnerChainPerStrikePriceInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OptionChainInnerChainPerRootInnerChainPerStrikePriceInner.class); + } + + /** + * Convert an instance of OptionChainInnerChainPerRootInnerChainPerStrikePriceInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/OptionLeg.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/OptionLeg.java new file mode 100644 index 0000000000..0b46eec3f5 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/OptionLeg.java @@ -0,0 +1,426 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Option Leg + */ +@ApiModel(description = "Option Leg")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class OptionLeg { + /** + * Gets or Sets action + */ + @JsonAdapter(ActionEnum.Adapter.class) + public enum ActionEnum { + BUY_TO_OPEN("BUY_TO_OPEN"), + + BUY_TO_CLOSE("BUY_TO_CLOSE"), + + SELL_TO_OPEN("SELL_TO_OPEN"), + + SELL_TO_CLOSE("SELL_TO_CLOSE"); + + private String value; + + ActionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ActionEnum fromValue(String value) { + for (ActionEnum b : ActionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ActionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ActionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ActionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_ACTION = "action"; + @SerializedName(SERIALIZED_NAME_ACTION) + private ActionEnum action; + + public static final String SERIALIZED_NAME_OPTION_SYMBOL_ID = "option_symbol_id"; + @SerializedName(SERIALIZED_NAME_OPTION_SYMBOL_ID) + private String optionSymbolId; + + public static final String SERIALIZED_NAME_QUANTITY = "quantity"; + @SerializedName(SERIALIZED_NAME_QUANTITY) + private Double quantity; + + public OptionLeg() { + } + + public OptionLeg action(ActionEnum action) { + + + + + this.action = action; + return this; + } + + /** + * Get action + * @return action + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public ActionEnum getAction() { + return action; + } + + + public void setAction(ActionEnum action) { + + + + this.action = action; + } + + + public OptionLeg optionSymbolId(String optionSymbolId) { + + + + + this.optionSymbolId = optionSymbolId; + return this; + } + + /** + * Obtained from calling options chain endpoint (option_id) + * @return optionSymbolId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "SPY220819P00200000", value = "Obtained from calling options chain endpoint (option_id)") + + public String getOptionSymbolId() { + return optionSymbolId; + } + + + public void setOptionSymbolId(String optionSymbolId) { + + + + this.optionSymbolId = optionSymbolId; + } + + + public OptionLeg quantity(Double quantity) { + + + + + this.quantity = quantity; + return this; + } + + public OptionLeg quantity(Integer quantity) { + + + + + this.quantity = quantity.doubleValue(); + return this; + } + + /** + * Get quantity + * @return quantity + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "1", value = "") + + public Double getQuantity() { + return quantity; + } + + + public void setQuantity(Double quantity) { + + + + this.quantity = quantity; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the OptionLeg instance itself + */ + public OptionLeg putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OptionLeg optionLeg = (OptionLeg) o; + return Objects.equals(this.action, optionLeg.action) && + Objects.equals(this.optionSymbolId, optionLeg.optionSymbolId) && + Objects.equals(this.quantity, optionLeg.quantity)&& + Objects.equals(this.additionalProperties, optionLeg.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(action, optionSymbolId, quantity, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OptionLeg {\n"); + sb.append(" action: ").append(toIndentedString(action)).append("\n"); + sb.append(" optionSymbolId: ").append(toIndentedString(optionSymbolId)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("action"); + openapiFields.add("option_symbol_id"); + openapiFields.add("quantity"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to OptionLeg + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!OptionLeg.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OptionLeg is not found in the empty JSON string", OptionLeg.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("action") != null && !jsonObj.get("action").isJsonNull()) && !jsonObj.get("action").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `action` to be a primitive type in the JSON string but got `%s`", jsonObj.get("action").toString())); + } + if ((jsonObj.get("option_symbol_id") != null && !jsonObj.get("option_symbol_id").isJsonNull()) && !jsonObj.get("option_symbol_id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `option_symbol_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("option_symbol_id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OptionLeg.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OptionLeg' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OptionLeg.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OptionLeg value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public OptionLeg read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + OptionLeg instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OptionLeg given an JSON string + * + * @param jsonString JSON string + * @return An instance of OptionLeg + * @throws IOException if the JSON string is invalid with respect to OptionLeg + */ + public static OptionLeg fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OptionLeg.class); + } + + /** + * Convert an instance of OptionLeg to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/OptionStrategy.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/OptionStrategy.java new file mode 100644 index 0000000000..d4ccc7833e --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/OptionStrategy.java @@ -0,0 +1,477 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.OptionStrategyLegsInner; +import com.konfigthis.client.model.UniversalSymbol; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * OptionStrategy + */@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class OptionStrategy { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private UUID id; + + public static final String SERIALIZED_NAME_UNDERLYING_SYMBOL_ID = "underlying_symbol_id"; + @SerializedName(SERIALIZED_NAME_UNDERLYING_SYMBOL_ID) + private UniversalSymbol underlyingSymbolId; + + public static final String SERIALIZED_NAME_STRATEGY_TYPE = "strategy_type"; + @SerializedName(SERIALIZED_NAME_STRATEGY_TYPE) + private String strategyType; + + public static final String SERIALIZED_NAME_NUMBER_OF_LEGS = "number_of_legs"; + @SerializedName(SERIALIZED_NAME_NUMBER_OF_LEGS) + private Double numberOfLegs; + + public static final String SERIALIZED_NAME_LEGS = "legs"; + @SerializedName(SERIALIZED_NAME_LEGS) + private List legs = null; + + public OptionStrategy() { + } + + public OptionStrategy id(UUID id) { + + + + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getId() { + return id; + } + + + public void setId(UUID id) { + + + + this.id = id; + } + + + public OptionStrategy underlyingSymbolId(UniversalSymbol underlyingSymbolId) { + + + + + this.underlyingSymbolId = underlyingSymbolId; + return this; + } + + /** + * Get underlyingSymbolId + * @return underlyingSymbolId + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public UniversalSymbol getUnderlyingSymbolId() { + return underlyingSymbolId; + } + + + public void setUnderlyingSymbolId(UniversalSymbol underlyingSymbolId) { + + + + this.underlyingSymbolId = underlyingSymbolId; + } + + + public OptionStrategy strategyType(String strategyType) { + + + + + this.strategyType = strategyType; + return this; + } + + /** + * Get strategyType + * @return strategyType + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "BUTTERFLY", value = "") + + public String getStrategyType() { + return strategyType; + } + + + public void setStrategyType(String strategyType) { + + + + this.strategyType = strategyType; + } + + + public OptionStrategy numberOfLegs(Double numberOfLegs) { + + + + + this.numberOfLegs = numberOfLegs; + return this; + } + + public OptionStrategy numberOfLegs(Integer numberOfLegs) { + + + + + this.numberOfLegs = numberOfLegs.doubleValue(); + return this; + } + + /** + * Get numberOfLegs + * @return numberOfLegs + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2", value = "") + + public Double getNumberOfLegs() { + return numberOfLegs; + } + + + public void setNumberOfLegs(Double numberOfLegs) { + + + + this.numberOfLegs = numberOfLegs; + } + + + public OptionStrategy legs(List legs) { + + + + + this.legs = legs; + return this; + } + + public OptionStrategy addLegsItem(OptionStrategyLegsInner legsItem) { + if (this.legs == null) { + this.legs = new ArrayList<>(); + } + this.legs.add(legsItem); + return this; + } + + /** + * Get legs + * @return legs + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public List getLegs() { + return legs; + } + + + public void setLegs(List legs) { + + + + this.legs = legs; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the OptionStrategy instance itself + */ + public OptionStrategy putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OptionStrategy optionStrategy = (OptionStrategy) o; + return Objects.equals(this.id, optionStrategy.id) && + Objects.equals(this.underlyingSymbolId, optionStrategy.underlyingSymbolId) && + Objects.equals(this.strategyType, optionStrategy.strategyType) && + Objects.equals(this.numberOfLegs, optionStrategy.numberOfLegs) && + Objects.equals(this.legs, optionStrategy.legs)&& + Objects.equals(this.additionalProperties, optionStrategy.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, underlyingSymbolId, strategyType, numberOfLegs, legs, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OptionStrategy {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" underlyingSymbolId: ").append(toIndentedString(underlyingSymbolId)).append("\n"); + sb.append(" strategyType: ").append(toIndentedString(strategyType)).append("\n"); + sb.append(" numberOfLegs: ").append(toIndentedString(numberOfLegs)).append("\n"); + sb.append(" legs: ").append(toIndentedString(legs)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("underlying_symbol_id"); + openapiFields.add("strategy_type"); + openapiFields.add("number_of_legs"); + openapiFields.add("legs"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to OptionStrategy + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!OptionStrategy.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OptionStrategy is not found in the empty JSON string", OptionStrategy.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `underlying_symbol_id` + if (jsonObj.get("underlying_symbol_id") != null && !jsonObj.get("underlying_symbol_id").isJsonNull()) { + UniversalSymbol.validateJsonObject(jsonObj.getAsJsonObject("underlying_symbol_id")); + } + if ((jsonObj.get("strategy_type") != null && !jsonObj.get("strategy_type").isJsonNull()) && !jsonObj.get("strategy_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `strategy_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("strategy_type").toString())); + } + if (jsonObj.get("legs") != null && !jsonObj.get("legs").isJsonNull()) { + JsonArray jsonArraylegs = jsonObj.getAsJsonArray("legs"); + if (jsonArraylegs != null) { + // ensure the json data is an array + if (!jsonObj.get("legs").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `legs` to be an array in the JSON string but got `%s`", jsonObj.get("legs").toString())); + } + + // validate the optional field `legs` (array) + for (int i = 0; i < jsonArraylegs.size(); i++) { + OptionStrategyLegsInner.validateJsonObject(jsonArraylegs.get(i).getAsJsonObject()); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OptionStrategy.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OptionStrategy' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OptionStrategy.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OptionStrategy value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public OptionStrategy read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + OptionStrategy instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OptionStrategy given an JSON string + * + * @param jsonString JSON string + * @return An instance of OptionStrategy + * @throws IOException if the JSON string is invalid with respect to OptionStrategy + */ + public static OptionStrategy fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OptionStrategy.class); + } + + /** + * Convert an instance of OptionStrategy to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/OptionStrategyLegsInner.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/OptionStrategyLegsInner.java new file mode 100644 index 0000000000..9f04969d3d --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/OptionStrategyLegsInner.java @@ -0,0 +1,419 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * OptionStrategyLegsInner + */@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class OptionStrategyLegsInner { + public static final String SERIALIZED_NAME_OPTION_SYMBOL_ID = "option_symbol_id"; + @SerializedName(SERIALIZED_NAME_OPTION_SYMBOL_ID) + private String optionSymbolId; + + public static final String SERIALIZED_NAME_INDEX = "index"; + @SerializedName(SERIALIZED_NAME_INDEX) + private Double index; + + public static final String SERIALIZED_NAME_ACTION = "action"; + @SerializedName(SERIALIZED_NAME_ACTION) + private String action; + + public static final String SERIALIZED_NAME_QUANTITY = "quantity"; + @SerializedName(SERIALIZED_NAME_QUANTITY) + private Double quantity; + + public OptionStrategyLegsInner() { + } + + public OptionStrategyLegsInner optionSymbolId(String optionSymbolId) { + + + + + this.optionSymbolId = optionSymbolId; + return this; + } + + /** + * Get optionSymbolId + * @return optionSymbolId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "AAPLC20221111", value = "") + + public String getOptionSymbolId() { + return optionSymbolId; + } + + + public void setOptionSymbolId(String optionSymbolId) { + + + + this.optionSymbolId = optionSymbolId; + } + + + public OptionStrategyLegsInner index(Double index) { + + + + + this.index = index; + return this; + } + + public OptionStrategyLegsInner index(Integer index) { + + + + + this.index = index.doubleValue(); + return this; + } + + /** + * Get index + * @return index + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "1", value = "") + + public Double getIndex() { + return index; + } + + + public void setIndex(Double index) { + + + + this.index = index; + } + + + public OptionStrategyLegsInner action(String action) { + + + + + this.action = action; + return this; + } + + /** + * Get action + * @return action + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "BUY_TO_OPEN", value = "") + + public String getAction() { + return action; + } + + + public void setAction(String action) { + + + + this.action = action; + } + + + public OptionStrategyLegsInner quantity(Double quantity) { + + + + + this.quantity = quantity; + return this; + } + + public OptionStrategyLegsInner quantity(Integer quantity) { + + + + + this.quantity = quantity.doubleValue(); + return this; + } + + /** + * Get quantity + * @return quantity + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "10", value = "") + + public Double getQuantity() { + return quantity; + } + + + public void setQuantity(Double quantity) { + + + + this.quantity = quantity; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the OptionStrategyLegsInner instance itself + */ + public OptionStrategyLegsInner putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OptionStrategyLegsInner optionStrategyLegsInner = (OptionStrategyLegsInner) o; + return Objects.equals(this.optionSymbolId, optionStrategyLegsInner.optionSymbolId) && + Objects.equals(this.index, optionStrategyLegsInner.index) && + Objects.equals(this.action, optionStrategyLegsInner.action) && + Objects.equals(this.quantity, optionStrategyLegsInner.quantity)&& + Objects.equals(this.additionalProperties, optionStrategyLegsInner.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(optionSymbolId, index, action, quantity, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OptionStrategyLegsInner {\n"); + sb.append(" optionSymbolId: ").append(toIndentedString(optionSymbolId)).append("\n"); + sb.append(" index: ").append(toIndentedString(index)).append("\n"); + sb.append(" action: ").append(toIndentedString(action)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("option_symbol_id"); + openapiFields.add("index"); + openapiFields.add("action"); + openapiFields.add("quantity"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to OptionStrategyLegsInner + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!OptionStrategyLegsInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OptionStrategyLegsInner is not found in the empty JSON string", OptionStrategyLegsInner.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("option_symbol_id") != null && !jsonObj.get("option_symbol_id").isJsonNull()) && !jsonObj.get("option_symbol_id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `option_symbol_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("option_symbol_id").toString())); + } + if ((jsonObj.get("action") != null && !jsonObj.get("action").isJsonNull()) && !jsonObj.get("action").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `action` to be a primitive type in the JSON string but got `%s`", jsonObj.get("action").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OptionStrategyLegsInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OptionStrategyLegsInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OptionStrategyLegsInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OptionStrategyLegsInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public OptionStrategyLegsInner read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + OptionStrategyLegsInner instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OptionStrategyLegsInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of OptionStrategyLegsInner + * @throws IOException if the JSON string is invalid with respect to OptionStrategyLegsInner + */ + public static OptionStrategyLegsInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OptionStrategyLegsInner.class); + } + + /** + * Convert an instance of OptionStrategyLegsInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/OptionsGetOptionStrategyRequest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/OptionsGetOptionStrategyRequest.java new file mode 100644 index 0000000000..f4373f024c --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/OptionsGetOptionStrategyRequest.java @@ -0,0 +1,439 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.OptionLeg; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * OptionsGetOptionStrategyRequest + */@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class OptionsGetOptionStrategyRequest { + public static final String SERIALIZED_NAME_UNDERLYING_SYMBOL_ID = "underlying_symbol_id"; + @SerializedName(SERIALIZED_NAME_UNDERLYING_SYMBOL_ID) + private UUID underlyingSymbolId; + + public static final String SERIALIZED_NAME_LEGS = "legs"; + @SerializedName(SERIALIZED_NAME_LEGS) + private List legs = new ArrayList<>(); + + /** + * Gets or Sets strategyType + */ + @JsonAdapter(StrategyTypeEnum.Adapter.class) + public enum StrategyTypeEnum { + CUSTOM("CUSTOM"); + + private String value; + + StrategyTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StrategyTypeEnum fromValue(String value) { + for (StrategyTypeEnum b : StrategyTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StrategyTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StrategyTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StrategyTypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STRATEGY_TYPE = "strategy_type"; + @SerializedName(SERIALIZED_NAME_STRATEGY_TYPE) + private StrategyTypeEnum strategyType; + + public OptionsGetOptionStrategyRequest() { + } + + public OptionsGetOptionStrategyRequest underlyingSymbolId(UUID underlyingSymbolId) { + + + + + this.underlyingSymbolId = underlyingSymbolId; + return this; + } + + /** + * Get underlyingSymbolId + * @return underlyingSymbolId + **/ + @javax.annotation.Nonnull + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", required = true, value = "") + + public UUID getUnderlyingSymbolId() { + return underlyingSymbolId; + } + + + public void setUnderlyingSymbolId(UUID underlyingSymbolId) { + + + + this.underlyingSymbolId = underlyingSymbolId; + } + + + public OptionsGetOptionStrategyRequest legs(List legs) { + + + + + this.legs = legs; + return this; + } + + public OptionsGetOptionStrategyRequest addLegsItem(OptionLeg legsItem) { + this.legs.add(legsItem); + return this; + } + + /** + * Get legs + * @return legs + **/ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + + public List getLegs() { + return legs; + } + + + public void setLegs(List legs) { + + + + this.legs = legs; + } + + + public OptionsGetOptionStrategyRequest strategyType(StrategyTypeEnum strategyType) { + + + + + this.strategyType = strategyType; + return this; + } + + /** + * Get strategyType + * @return strategyType + **/ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + + public StrategyTypeEnum getStrategyType() { + return strategyType; + } + + + public void setStrategyType(StrategyTypeEnum strategyType) { + + + + this.strategyType = strategyType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the OptionsGetOptionStrategyRequest instance itself + */ + public OptionsGetOptionStrategyRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OptionsGetOptionStrategyRequest optionsGetOptionStrategyRequest = (OptionsGetOptionStrategyRequest) o; + return Objects.equals(this.underlyingSymbolId, optionsGetOptionStrategyRequest.underlyingSymbolId) && + Objects.equals(this.legs, optionsGetOptionStrategyRequest.legs) && + Objects.equals(this.strategyType, optionsGetOptionStrategyRequest.strategyType)&& + Objects.equals(this.additionalProperties, optionsGetOptionStrategyRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(underlyingSymbolId, legs, strategyType, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OptionsGetOptionStrategyRequest {\n"); + sb.append(" underlyingSymbolId: ").append(toIndentedString(underlyingSymbolId)).append("\n"); + sb.append(" legs: ").append(toIndentedString(legs)).append("\n"); + sb.append(" strategyType: ").append(toIndentedString(strategyType)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("underlying_symbol_id"); + openapiFields.add("legs"); + openapiFields.add("strategy_type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("underlying_symbol_id"); + openapiRequiredFields.add("legs"); + openapiRequiredFields.add("strategy_type"); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to OptionsGetOptionStrategyRequest + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!OptionsGetOptionStrategyRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OptionsGetOptionStrategyRequest is not found in the empty JSON string", OptionsGetOptionStrategyRequest.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OptionsGetOptionStrategyRequest.openapiRequiredFields) { + if (jsonObj.get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + } + } + if (!jsonObj.get("underlying_symbol_id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `underlying_symbol_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("underlying_symbol_id").toString())); + } + // ensure the json data is an array + if (!jsonObj.get("legs").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `legs` to be an array in the JSON string but got `%s`", jsonObj.get("legs").toString())); + } + + JsonArray jsonArraylegs = jsonObj.getAsJsonArray("legs"); + // validate the required field `legs` (array) + for (int i = 0; i < jsonArraylegs.size(); i++) { + OptionLeg.validateJsonObject(jsonArraylegs.get(i).getAsJsonObject()); + }; + if (!jsonObj.get("strategy_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `strategy_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("strategy_type").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OptionsGetOptionStrategyRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OptionsGetOptionStrategyRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OptionsGetOptionStrategyRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OptionsGetOptionStrategyRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public OptionsGetOptionStrategyRequest read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + OptionsGetOptionStrategyRequest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OptionsGetOptionStrategyRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of OptionsGetOptionStrategyRequest + * @throws IOException if the JSON string is invalid with respect to OptionsGetOptionStrategyRequest + */ + public static OptionsGetOptionStrategyRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OptionsGetOptionStrategyRequest.class); + } + + /** + * Convert an instance of OptionsGetOptionStrategyRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/OptionsPlaceOptionStrategyRequest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/OptionsPlaceOptionStrategyRequest.java new file mode 100644 index 0000000000..fbdabb1602 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/OptionsPlaceOptionStrategyRequest.java @@ -0,0 +1,391 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.OrderTypeStrict; +import com.konfigthis.client.model.TimeInForceStrict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * OptionsPlaceOptionStrategyRequest + */@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class OptionsPlaceOptionStrategyRequest { + public static final String SERIALIZED_NAME_ORDER_TYPE = "order_type"; + @SerializedName(SERIALIZED_NAME_ORDER_TYPE) + private OrderTypeStrict orderType; + + public static final String SERIALIZED_NAME_TIME_IN_FORCE = "time_in_force"; + @SerializedName(SERIALIZED_NAME_TIME_IN_FORCE) + private TimeInForceStrict timeInForce; + + public static final String SERIALIZED_NAME_PRICE = "price"; + @SerializedName(SERIALIZED_NAME_PRICE) + private Double price; + + public OptionsPlaceOptionStrategyRequest() { + } + + public OptionsPlaceOptionStrategyRequest orderType(OrderTypeStrict orderType) { + + + + + this.orderType = orderType; + return this; + } + + /** + * Get orderType + * @return orderType + **/ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + + public OrderTypeStrict getOrderType() { + return orderType; + } + + + public void setOrderType(OrderTypeStrict orderType) { + + + + this.orderType = orderType; + } + + + public OptionsPlaceOptionStrategyRequest timeInForce(TimeInForceStrict timeInForce) { + + + + + this.timeInForce = timeInForce; + return this; + } + + /** + * Get timeInForce + * @return timeInForce + **/ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + + public TimeInForceStrict getTimeInForce() { + return timeInForce; + } + + + public void setTimeInForce(TimeInForceStrict timeInForce) { + + + + this.timeInForce = timeInForce; + } + + + public OptionsPlaceOptionStrategyRequest price(Double price) { + + + + + this.price = price; + return this; + } + + public OptionsPlaceOptionStrategyRequest price(Integer price) { + + + + + this.price = price.doubleValue(); + return this; + } + + /** + * Trade Price if limit or stop limit order + * @return price + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "31.33", value = "Trade Price if limit or stop limit order") + + public Double getPrice() { + return price; + } + + + public void setPrice(Double price) { + + + + this.price = price; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the OptionsPlaceOptionStrategyRequest instance itself + */ + public OptionsPlaceOptionStrategyRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OptionsPlaceOptionStrategyRequest optionsPlaceOptionStrategyRequest = (OptionsPlaceOptionStrategyRequest) o; + return Objects.equals(this.orderType, optionsPlaceOptionStrategyRequest.orderType) && + Objects.equals(this.timeInForce, optionsPlaceOptionStrategyRequest.timeInForce) && + Objects.equals(this.price, optionsPlaceOptionStrategyRequest.price)&& + Objects.equals(this.additionalProperties, optionsPlaceOptionStrategyRequest.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(orderType, timeInForce, price, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OptionsPlaceOptionStrategyRequest {\n"); + sb.append(" orderType: ").append(toIndentedString(orderType)).append("\n"); + sb.append(" timeInForce: ").append(toIndentedString(timeInForce)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("order_type"); + openapiFields.add("time_in_force"); + openapiFields.add("price"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("order_type"); + openapiRequiredFields.add("time_in_force"); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to OptionsPlaceOptionStrategyRequest + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!OptionsPlaceOptionStrategyRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OptionsPlaceOptionStrategyRequest is not found in the empty JSON string", OptionsPlaceOptionStrategyRequest.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OptionsPlaceOptionStrategyRequest.openapiRequiredFields) { + if (jsonObj.get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OptionsPlaceOptionStrategyRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OptionsPlaceOptionStrategyRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OptionsPlaceOptionStrategyRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OptionsPlaceOptionStrategyRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public OptionsPlaceOptionStrategyRequest read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + OptionsPlaceOptionStrategyRequest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OptionsPlaceOptionStrategyRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of OptionsPlaceOptionStrategyRequest + * @throws IOException if the JSON string is invalid with respect to OptionsPlaceOptionStrategyRequest + */ + public static OptionsPlaceOptionStrategyRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OptionsPlaceOptionStrategyRequest.class); + } + + /** + * Convert an instance of OptionsPlaceOptionStrategyRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/OptionsPosition.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/OptionsPosition.java new file mode 100644 index 0000000000..e34dc16a31 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/OptionsPosition.java @@ -0,0 +1,481 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.CurrencyNullable; +import com.konfigthis.client.model.OptionBrokerageSymbol; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Describes a single option position in an account. + */ +@ApiModel(description = "Describes a single option position in an account.")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class OptionsPosition { + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + @SerializedName(SERIALIZED_NAME_SYMBOL) + private OptionBrokerageSymbol symbol; + + public static final String SERIALIZED_NAME_PRICE = "price"; + @SerializedName(SERIALIZED_NAME_PRICE) + private Double price; + + public static final String SERIALIZED_NAME_UNITS = "units"; + @SerializedName(SERIALIZED_NAME_UNITS) + private Double units; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + private CurrencyNullable currency; + + public static final String SERIALIZED_NAME_AVERAGE_PURCHASE_PRICE = "average_purchase_price"; + @SerializedName(SERIALIZED_NAME_AVERAGE_PURCHASE_PRICE) + private Double averagePurchasePrice; + + public OptionsPosition() { + } + + public OptionsPosition symbol(OptionBrokerageSymbol symbol) { + + + + + this.symbol = symbol; + return this; + } + + /** + * Get symbol + * @return symbol + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public OptionBrokerageSymbol getSymbol() { + return symbol; + } + + + public void setSymbol(OptionBrokerageSymbol symbol) { + + + + this.symbol = symbol; + } + + + public OptionsPosition price(Double price) { + + + + + this.price = price; + return this; + } + + public OptionsPosition price(Integer price) { + + + + + this.price = price.doubleValue(); + return this; + } + + /** + * Last known market price for the option contract. The freshness of this price depends on the brokerage. Some brokerages provide real-time prices, while others provide delayed prices. It is recommended that you rely on your own third-party market data provider for most up to date prices. + * @return price + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "113.15", value = "Last known market price for the option contract. The freshness of this price depends on the brokerage. Some brokerages provide real-time prices, while others provide delayed prices. It is recommended that you rely on your own third-party market data provider for most up to date prices.") + + public Double getPrice() { + return price; + } + + + public void setPrice(Double price) { + + + + this.price = price; + } + + + public OptionsPosition units(Double units) { + + + + + this.units = units; + return this; + } + + public OptionsPosition units(Integer units) { + + + + + this.units = units.doubleValue(); + return this; + } + + /** + * The number of contracts for this option position. + * @return units + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "10", value = "The number of contracts for this option position.") + + public Double getUnits() { + return units; + } + + + public void setUnits(Double units) { + + + + this.units = units; + } + + + public OptionsPosition currency(CurrencyNullable currency) { + + + + + this.currency = currency; + return this; + } + + /** + * Get currency + * @return currency + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public CurrencyNullable getCurrency() { + return currency; + } + + + public void setCurrency(CurrencyNullable currency) { + + + + this.currency = currency; + } + + + public OptionsPosition averagePurchasePrice(Double averagePurchasePrice) { + + + + + this.averagePurchasePrice = averagePurchasePrice; + return this; + } + + public OptionsPosition averagePurchasePrice(Integer averagePurchasePrice) { + + + + + this.averagePurchasePrice = averagePurchasePrice.doubleValue(); + return this; + } + + /** + * Cost basis _per contract_ of this option position. To get the cost basis _per share_, divide this value by the number of shares per contract (usually 100). + * @return averagePurchasePrice + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "108.3353", value = "Cost basis _per contract_ of this option position. To get the cost basis _per share_, divide this value by the number of shares per contract (usually 100).") + + public Double getAveragePurchasePrice() { + return averagePurchasePrice; + } + + + public void setAveragePurchasePrice(Double averagePurchasePrice) { + + + + this.averagePurchasePrice = averagePurchasePrice; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the OptionsPosition instance itself + */ + public OptionsPosition putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OptionsPosition optionsPosition = (OptionsPosition) o; + return Objects.equals(this.symbol, optionsPosition.symbol) && + Objects.equals(this.price, optionsPosition.price) && + Objects.equals(this.units, optionsPosition.units) && + Objects.equals(this.currency, optionsPosition.currency) && + Objects.equals(this.averagePurchasePrice, optionsPosition.averagePurchasePrice)&& + Objects.equals(this.additionalProperties, optionsPosition.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(symbol, price, units, currency, averagePurchasePrice, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OptionsPosition {\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append(" units: ").append(toIndentedString(units)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append(" averagePurchasePrice: ").append(toIndentedString(averagePurchasePrice)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("symbol"); + openapiFields.add("price"); + openapiFields.add("units"); + openapiFields.add("currency"); + openapiFields.add("average_purchase_price"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to OptionsPosition + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!OptionsPosition.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OptionsPosition is not found in the empty JSON string", OptionsPosition.openapiRequiredFields.toString())); + } + } + // validate the optional field `symbol` + if (jsonObj.get("symbol") != null && !jsonObj.get("symbol").isJsonNull()) { + OptionBrokerageSymbol.validateJsonObject(jsonObj.getAsJsonObject("symbol")); + } + // validate the optional field `currency` + if (jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) { + CurrencyNullable.validateJsonObject(jsonObj.getAsJsonObject("currency")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OptionsPosition.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OptionsPosition' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OptionsPosition.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OptionsPosition value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public OptionsPosition read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + OptionsPosition instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OptionsPosition given an JSON string + * + * @param jsonString JSON string + * @return An instance of OptionsPosition + * @throws IOException if the JSON string is invalid with respect to OptionsPosition + */ + public static OptionsPosition fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OptionsPosition.class); + } + + /** + * Convert an instance of OptionsPosition to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/OptionsSymbol.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/OptionsSymbol.java new file mode 100644 index 0000000000..7005e09361 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/OptionsSymbol.java @@ -0,0 +1,667 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.UnderlyingSymbol; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Options Symbol + */ +@ApiModel(description = "Options Symbol")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class OptionsSymbol { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private UUID id; + + public static final String SERIALIZED_NAME_TICKER = "ticker"; + @SerializedName(SERIALIZED_NAME_TICKER) + private String ticker; + + /** + * Gets or Sets optionType + */ + @JsonAdapter(OptionTypeEnum.Adapter.class) + public enum OptionTypeEnum { + CALL("CALL"), + + PUT("PUT"); + + private String value; + + OptionTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static OptionTypeEnum fromValue(String value) { + for (OptionTypeEnum b : OptionTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final OptionTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public OptionTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return OptionTypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_OPTION_TYPE = "option_type"; + @SerializedName(SERIALIZED_NAME_OPTION_TYPE) + private OptionTypeEnum optionType; + + public static final String SERIALIZED_NAME_STRIKE_PRICE = "strike_price"; + @SerializedName(SERIALIZED_NAME_STRIKE_PRICE) + private Double strikePrice; + + public static final String SERIALIZED_NAME_EXPIRATION_DATE = "expiration_date"; + @SerializedName(SERIALIZED_NAME_EXPIRATION_DATE) + private String expirationDate; + + public static final String SERIALIZED_NAME_IS_MINI_OPTION = "is_mini_option"; + @SerializedName(SERIALIZED_NAME_IS_MINI_OPTION) + private Boolean isMiniOption; + + public static final String SERIALIZED_NAME_UNDERLYING_SYMBOL = "underlying_symbol"; + @SerializedName(SERIALIZED_NAME_UNDERLYING_SYMBOL) + private UnderlyingSymbol underlyingSymbol; + + public static final String SERIALIZED_NAME_LOCAL_ID = "local_id"; + @SerializedName(SERIALIZED_NAME_LOCAL_ID) + private String localId; + + public static final String SERIALIZED_NAME_EXCHANGE_ID = "exchange_id"; + @SerializedName(SERIALIZED_NAME_EXCHANGE_ID) + private UUID exchangeId; + + public OptionsSymbol() { + } + + public OptionsSymbol id(UUID id) { + + + + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", required = true, value = "") + + public UUID getId() { + return id; + } + + + public void setId(UUID id) { + + + + this.id = id; + } + + + public OptionsSymbol ticker(String ticker) { + + + + + this.ticker = ticker; + return this; + } + + /** + * Get ticker + * @return ticker + **/ + @javax.annotation.Nonnull + @ApiModelProperty(example = "SPY 220819P00200000", required = true, value = "") + + public String getTicker() { + return ticker; + } + + + public void setTicker(String ticker) { + + + + this.ticker = ticker; + } + + + public OptionsSymbol optionType(OptionTypeEnum optionType) { + + + + + this.optionType = optionType; + return this; + } + + /** + * Get optionType + * @return optionType + **/ + @javax.annotation.Nonnull + @ApiModelProperty(example = "CALL", required = true, value = "") + + public OptionTypeEnum getOptionType() { + return optionType; + } + + + public void setOptionType(OptionTypeEnum optionType) { + + + + this.optionType = optionType; + } + + + public OptionsSymbol strikePrice(Double strikePrice) { + + + + + this.strikePrice = strikePrice; + return this; + } + + public OptionsSymbol strikePrice(Integer strikePrice) { + + + + + this.strikePrice = strikePrice.doubleValue(); + return this; + } + + /** + * Get strikePrice + * @return strikePrice + **/ + @javax.annotation.Nonnull + @ApiModelProperty(example = "200", required = true, value = "") + + public Double getStrikePrice() { + return strikePrice; + } + + + public void setStrikePrice(Double strikePrice) { + + + + this.strikePrice = strikePrice; + } + + + public OptionsSymbol expirationDate(String expirationDate) { + + + + + this.expirationDate = expirationDate; + return this; + } + + /** + * Get expirationDate + * @return expirationDate + **/ + @javax.annotation.Nonnull + @ApiModelProperty(example = "2017-07-17T15:13:07.177712+00:00", required = true, value = "") + + public String getExpirationDate() { + return expirationDate; + } + + + public void setExpirationDate(String expirationDate) { + + + + this.expirationDate = expirationDate; + } + + + public OptionsSymbol isMiniOption(Boolean isMiniOption) { + + + + + this.isMiniOption = isMiniOption; + return this; + } + + /** + * Get isMiniOption + * @return isMiniOption + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "false", value = "") + + public Boolean getIsMiniOption() { + return isMiniOption; + } + + + public void setIsMiniOption(Boolean isMiniOption) { + + + + this.isMiniOption = isMiniOption; + } + + + public OptionsSymbol underlyingSymbol(UnderlyingSymbol underlyingSymbol) { + + + + + this.underlyingSymbol = underlyingSymbol; + return this; + } + + /** + * Get underlyingSymbol + * @return underlyingSymbol + **/ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + + public UnderlyingSymbol getUnderlyingSymbol() { + return underlyingSymbol; + } + + + public void setUnderlyingSymbol(UnderlyingSymbol underlyingSymbol) { + + + + this.underlyingSymbol = underlyingSymbol; + } + + + public OptionsSymbol localId(String localId) { + + + + + this.localId = localId; + return this; + } + + /** + * Get localId + * @return localId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "40817960", value = "") + + public String getLocalId() { + return localId; + } + + + public void setLocalId(String localId) { + + + + this.localId = localId; + } + + + public OptionsSymbol exchangeId(UUID exchangeId) { + + + + + this.exchangeId = exchangeId; + return this; + } + + /** + * Get exchangeId + * @return exchangeId + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public UUID getExchangeId() { + return exchangeId; + } + + + public void setExchangeId(UUID exchangeId) { + + + + this.exchangeId = exchangeId; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the OptionsSymbol instance itself + */ + public OptionsSymbol putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OptionsSymbol optionsSymbol = (OptionsSymbol) o; + return Objects.equals(this.id, optionsSymbol.id) && + Objects.equals(this.ticker, optionsSymbol.ticker) && + Objects.equals(this.optionType, optionsSymbol.optionType) && + Objects.equals(this.strikePrice, optionsSymbol.strikePrice) && + Objects.equals(this.expirationDate, optionsSymbol.expirationDate) && + Objects.equals(this.isMiniOption, optionsSymbol.isMiniOption) && + Objects.equals(this.underlyingSymbol, optionsSymbol.underlyingSymbol) && + Objects.equals(this.localId, optionsSymbol.localId) && + Objects.equals(this.exchangeId, optionsSymbol.exchangeId)&& + Objects.equals(this.additionalProperties, optionsSymbol.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, ticker, optionType, strikePrice, expirationDate, isMiniOption, underlyingSymbol, localId, exchangeId, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OptionsSymbol {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" ticker: ").append(toIndentedString(ticker)).append("\n"); + sb.append(" optionType: ").append(toIndentedString(optionType)).append("\n"); + sb.append(" strikePrice: ").append(toIndentedString(strikePrice)).append("\n"); + sb.append(" expirationDate: ").append(toIndentedString(expirationDate)).append("\n"); + sb.append(" isMiniOption: ").append(toIndentedString(isMiniOption)).append("\n"); + sb.append(" underlyingSymbol: ").append(toIndentedString(underlyingSymbol)).append("\n"); + sb.append(" localId: ").append(toIndentedString(localId)).append("\n"); + sb.append(" exchangeId: ").append(toIndentedString(exchangeId)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("ticker"); + openapiFields.add("option_type"); + openapiFields.add("strike_price"); + openapiFields.add("expiration_date"); + openapiFields.add("is_mini_option"); + openapiFields.add("underlying_symbol"); + openapiFields.add("local_id"); + openapiFields.add("exchange_id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("ticker"); + openapiRequiredFields.add("option_type"); + openapiRequiredFields.add("strike_price"); + openapiRequiredFields.add("expiration_date"); + openapiRequiredFields.add("underlying_symbol"); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to OptionsSymbol + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!OptionsSymbol.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OptionsSymbol is not found in the empty JSON string", OptionsSymbol.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OptionsSymbol.openapiRequiredFields) { + if (jsonObj.get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + } + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (!jsonObj.get("ticker").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ticker` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ticker").toString())); + } + if (!jsonObj.get("option_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `option_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("option_type").toString())); + } + if (!jsonObj.get("expiration_date").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `expiration_date` to be a primitive type in the JSON string but got `%s`", jsonObj.get("expiration_date").toString())); + } + // validate the required field `underlying_symbol` + UnderlyingSymbol.validateJsonObject(jsonObj.getAsJsonObject("underlying_symbol")); + if ((jsonObj.get("local_id") != null && !jsonObj.get("local_id").isJsonNull()) && !jsonObj.get("local_id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `local_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("local_id").toString())); + } + if ((jsonObj.get("exchange_id") != null && !jsonObj.get("exchange_id").isJsonNull()) && !jsonObj.get("exchange_id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `exchange_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("exchange_id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OptionsSymbol.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OptionsSymbol' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OptionsSymbol.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OptionsSymbol value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public OptionsSymbol read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + OptionsSymbol instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OptionsSymbol given an JSON string + * + * @param jsonString JSON string + * @return An instance of OptionsSymbol + * @throws IOException if the JSON string is invalid with respect to OptionsSymbol + */ + public static OptionsSymbol fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OptionsSymbol.class); + } + + /** + * Convert an instance of OptionsSymbol to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/OptionsSymbolNullable.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/OptionsSymbolNullable.java new file mode 100644 index 0000000000..5a1f61e8be --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/OptionsSymbolNullable.java @@ -0,0 +1,667 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.UnderlyingSymbol; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Options Symbol + */ +@ApiModel(description = "Options Symbol")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class OptionsSymbolNullable { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private UUID id; + + public static final String SERIALIZED_NAME_TICKER = "ticker"; + @SerializedName(SERIALIZED_NAME_TICKER) + private String ticker; + + /** + * Gets or Sets optionType + */ + @JsonAdapter(OptionTypeEnum.Adapter.class) + public enum OptionTypeEnum { + CALL("CALL"), + + PUT("PUT"); + + private String value; + + OptionTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static OptionTypeEnum fromValue(String value) { + for (OptionTypeEnum b : OptionTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final OptionTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public OptionTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return OptionTypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_OPTION_TYPE = "option_type"; + @SerializedName(SERIALIZED_NAME_OPTION_TYPE) + private OptionTypeEnum optionType; + + public static final String SERIALIZED_NAME_STRIKE_PRICE = "strike_price"; + @SerializedName(SERIALIZED_NAME_STRIKE_PRICE) + private Double strikePrice; + + public static final String SERIALIZED_NAME_EXPIRATION_DATE = "expiration_date"; + @SerializedName(SERIALIZED_NAME_EXPIRATION_DATE) + private String expirationDate; + + public static final String SERIALIZED_NAME_IS_MINI_OPTION = "is_mini_option"; + @SerializedName(SERIALIZED_NAME_IS_MINI_OPTION) + private Boolean isMiniOption; + + public static final String SERIALIZED_NAME_UNDERLYING_SYMBOL = "underlying_symbol"; + @SerializedName(SERIALIZED_NAME_UNDERLYING_SYMBOL) + private UnderlyingSymbol underlyingSymbol; + + public static final String SERIALIZED_NAME_LOCAL_ID = "local_id"; + @SerializedName(SERIALIZED_NAME_LOCAL_ID) + private String localId; + + public static final String SERIALIZED_NAME_EXCHANGE_ID = "exchange_id"; + @SerializedName(SERIALIZED_NAME_EXCHANGE_ID) + private UUID exchangeId; + + public OptionsSymbolNullable() { + } + + public OptionsSymbolNullable id(UUID id) { + + + + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", required = true, value = "") + + public UUID getId() { + return id; + } + + + public void setId(UUID id) { + + + + this.id = id; + } + + + public OptionsSymbolNullable ticker(String ticker) { + + + + + this.ticker = ticker; + return this; + } + + /** + * Get ticker + * @return ticker + **/ + @javax.annotation.Nonnull + @ApiModelProperty(example = "SPY 220819P00200000", required = true, value = "") + + public String getTicker() { + return ticker; + } + + + public void setTicker(String ticker) { + + + + this.ticker = ticker; + } + + + public OptionsSymbolNullable optionType(OptionTypeEnum optionType) { + + + + + this.optionType = optionType; + return this; + } + + /** + * Get optionType + * @return optionType + **/ + @javax.annotation.Nonnull + @ApiModelProperty(example = "CALL", required = true, value = "") + + public OptionTypeEnum getOptionType() { + return optionType; + } + + + public void setOptionType(OptionTypeEnum optionType) { + + + + this.optionType = optionType; + } + + + public OptionsSymbolNullable strikePrice(Double strikePrice) { + + + + + this.strikePrice = strikePrice; + return this; + } + + public OptionsSymbolNullable strikePrice(Integer strikePrice) { + + + + + this.strikePrice = strikePrice.doubleValue(); + return this; + } + + /** + * Get strikePrice + * @return strikePrice + **/ + @javax.annotation.Nonnull + @ApiModelProperty(example = "200", required = true, value = "") + + public Double getStrikePrice() { + return strikePrice; + } + + + public void setStrikePrice(Double strikePrice) { + + + + this.strikePrice = strikePrice; + } + + + public OptionsSymbolNullable expirationDate(String expirationDate) { + + + + + this.expirationDate = expirationDate; + return this; + } + + /** + * Get expirationDate + * @return expirationDate + **/ + @javax.annotation.Nonnull + @ApiModelProperty(example = "2017-07-17T15:13:07.177712+00:00", required = true, value = "") + + public String getExpirationDate() { + return expirationDate; + } + + + public void setExpirationDate(String expirationDate) { + + + + this.expirationDate = expirationDate; + } + + + public OptionsSymbolNullable isMiniOption(Boolean isMiniOption) { + + + + + this.isMiniOption = isMiniOption; + return this; + } + + /** + * Get isMiniOption + * @return isMiniOption + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "false", value = "") + + public Boolean getIsMiniOption() { + return isMiniOption; + } + + + public void setIsMiniOption(Boolean isMiniOption) { + + + + this.isMiniOption = isMiniOption; + } + + + public OptionsSymbolNullable underlyingSymbol(UnderlyingSymbol underlyingSymbol) { + + + + + this.underlyingSymbol = underlyingSymbol; + return this; + } + + /** + * Get underlyingSymbol + * @return underlyingSymbol + **/ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + + public UnderlyingSymbol getUnderlyingSymbol() { + return underlyingSymbol; + } + + + public void setUnderlyingSymbol(UnderlyingSymbol underlyingSymbol) { + + + + this.underlyingSymbol = underlyingSymbol; + } + + + public OptionsSymbolNullable localId(String localId) { + + + + + this.localId = localId; + return this; + } + + /** + * Get localId + * @return localId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "40817960", value = "") + + public String getLocalId() { + return localId; + } + + + public void setLocalId(String localId) { + + + + this.localId = localId; + } + + + public OptionsSymbolNullable exchangeId(UUID exchangeId) { + + + + + this.exchangeId = exchangeId; + return this; + } + + /** + * Get exchangeId + * @return exchangeId + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public UUID getExchangeId() { + return exchangeId; + } + + + public void setExchangeId(UUID exchangeId) { + + + + this.exchangeId = exchangeId; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the OptionsSymbolNullable instance itself + */ + public OptionsSymbolNullable putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OptionsSymbolNullable optionsSymbolNullable = (OptionsSymbolNullable) o; + return Objects.equals(this.id, optionsSymbolNullable.id) && + Objects.equals(this.ticker, optionsSymbolNullable.ticker) && + Objects.equals(this.optionType, optionsSymbolNullable.optionType) && + Objects.equals(this.strikePrice, optionsSymbolNullable.strikePrice) && + Objects.equals(this.expirationDate, optionsSymbolNullable.expirationDate) && + Objects.equals(this.isMiniOption, optionsSymbolNullable.isMiniOption) && + Objects.equals(this.underlyingSymbol, optionsSymbolNullable.underlyingSymbol) && + Objects.equals(this.localId, optionsSymbolNullable.localId) && + Objects.equals(this.exchangeId, optionsSymbolNullable.exchangeId)&& + Objects.equals(this.additionalProperties, optionsSymbolNullable.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, ticker, optionType, strikePrice, expirationDate, isMiniOption, underlyingSymbol, localId, exchangeId, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OptionsSymbolNullable {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" ticker: ").append(toIndentedString(ticker)).append("\n"); + sb.append(" optionType: ").append(toIndentedString(optionType)).append("\n"); + sb.append(" strikePrice: ").append(toIndentedString(strikePrice)).append("\n"); + sb.append(" expirationDate: ").append(toIndentedString(expirationDate)).append("\n"); + sb.append(" isMiniOption: ").append(toIndentedString(isMiniOption)).append("\n"); + sb.append(" underlyingSymbol: ").append(toIndentedString(underlyingSymbol)).append("\n"); + sb.append(" localId: ").append(toIndentedString(localId)).append("\n"); + sb.append(" exchangeId: ").append(toIndentedString(exchangeId)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("ticker"); + openapiFields.add("option_type"); + openapiFields.add("strike_price"); + openapiFields.add("expiration_date"); + openapiFields.add("is_mini_option"); + openapiFields.add("underlying_symbol"); + openapiFields.add("local_id"); + openapiFields.add("exchange_id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("ticker"); + openapiRequiredFields.add("option_type"); + openapiRequiredFields.add("strike_price"); + openapiRequiredFields.add("expiration_date"); + openapiRequiredFields.add("underlying_symbol"); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to OptionsSymbolNullable + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!OptionsSymbolNullable.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OptionsSymbolNullable is not found in the empty JSON string", OptionsSymbolNullable.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OptionsSymbolNullable.openapiRequiredFields) { + if (jsonObj.get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + } + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (!jsonObj.get("ticker").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ticker` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ticker").toString())); + } + if (!jsonObj.get("option_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `option_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("option_type").toString())); + } + if (!jsonObj.get("expiration_date").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `expiration_date` to be a primitive type in the JSON string but got `%s`", jsonObj.get("expiration_date").toString())); + } + // validate the required field `underlying_symbol` + UnderlyingSymbol.validateJsonObject(jsonObj.getAsJsonObject("underlying_symbol")); + if ((jsonObj.get("local_id") != null && !jsonObj.get("local_id").isJsonNull()) && !jsonObj.get("local_id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `local_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("local_id").toString())); + } + if ((jsonObj.get("exchange_id") != null && !jsonObj.get("exchange_id").isJsonNull()) && !jsonObj.get("exchange_id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `exchange_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("exchange_id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OptionsSymbolNullable.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OptionsSymbolNullable' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OptionsSymbolNullable.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OptionsSymbolNullable value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public OptionsSymbolNullable read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + OptionsSymbolNullable instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OptionsSymbolNullable given an JSON string + * + * @param jsonString JSON string + * @return An instance of OptionsSymbolNullable + * @throws IOException if the JSON string is invalid with respect to OptionsSymbolNullable + */ + public static OptionsSymbolNullable fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OptionsSymbolNullable.class); + } + + /** + * Convert an instance of OptionsSymbolNullable to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/OrderTypeStrict.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/OrderTypeStrict.java new file mode 100644 index 0000000000..73d36f2ee2 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/OrderTypeStrict.java @@ -0,0 +1,76 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Order Type + */ +@JsonAdapter(OrderTypeStrict.Adapter.class)public enum OrderTypeStrict { + + LIMIT("Limit"), + + MARKET("Market"), + + STOPLIMIT("StopLimit"), + + STOPLOSS("StopLoss"); + + private String value; + + OrderTypeStrict(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static OrderTypeStrict fromValue(String value) { + for (OrderTypeStrict b : OrderTypeStrict.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final OrderTypeStrict enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public OrderTypeStrict read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return OrderTypeStrict.fromValue(value); + } + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/PartnerData.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/PartnerData.java new file mode 100644 index 0000000000..5cef473b3f --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/PartnerData.java @@ -0,0 +1,721 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.Brokerage; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * SnapTrade Partner metadata + */ +@ApiModel(description = "SnapTrade Partner metadata")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class PartnerData { + public static final String SERIALIZED_NAME_REDIRECT_URI = "redirect_uri"; + @SerializedName(SERIALIZED_NAME_REDIRECT_URI) + private String redirectUri; + + public static final String SERIALIZED_NAME_ALLOWED_BROKERAGES = "allowed_brokerages"; + @SerializedName(SERIALIZED_NAME_ALLOWED_BROKERAGES) + private List allowedBrokerages = null; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_SLUG = "slug"; + @SerializedName(SERIALIZED_NAME_SLUG) + private String slug; + + public static final String SERIALIZED_NAME_LOGO_URL = "logo_url"; + @SerializedName(SERIALIZED_NAME_LOGO_URL) + private String logoUrl; + + public static final String SERIALIZED_NAME_PIN_REQUIRED = "pin_required"; + @SerializedName(SERIALIZED_NAME_PIN_REQUIRED) + private Boolean pinRequired; + + public static final String SERIALIZED_NAME_CAN_ACCESS_TRADES = "can_access_trades"; + @SerializedName(SERIALIZED_NAME_CAN_ACCESS_TRADES) + private Boolean canAccessTrades; + + public static final String SERIALIZED_NAME_CAN_ACCESS_HOLDINGS = "can_access_holdings"; + @SerializedName(SERIALIZED_NAME_CAN_ACCESS_HOLDINGS) + private Boolean canAccessHoldings; + + public static final String SERIALIZED_NAME_CAN_ACCESS_ACCOUNT_HISTORY = "can_access_account_history"; + @SerializedName(SERIALIZED_NAME_CAN_ACCESS_ACCOUNT_HISTORY) + private Boolean canAccessAccountHistory; + + public static final String SERIALIZED_NAME_CAN_ACCESS_REFERENCE_DATA = "can_access_reference_data"; + @SerializedName(SERIALIZED_NAME_CAN_ACCESS_REFERENCE_DATA) + private Boolean canAccessReferenceData; + + public static final String SERIALIZED_NAME_CAN_ACCESS_PORTFOLIO_MANAGEMENT = "can_access_portfolio_management"; + @SerializedName(SERIALIZED_NAME_CAN_ACCESS_PORTFOLIO_MANAGEMENT) + private Boolean canAccessPortfolioManagement; + + public static final String SERIALIZED_NAME_CAN_ACCESS_ORDERS = "can_access_orders"; + @SerializedName(SERIALIZED_NAME_CAN_ACCESS_ORDERS) + private Boolean canAccessOrders; + + public PartnerData() { + } + + public PartnerData redirectUri(String redirectUri) { + + + + + this.redirectUri = redirectUri; + return this; + } + + /** + * URI to redirect user back to after user is done adding brokerage connections + * @return redirectUri + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "https://example.com/oauth/snaptrade", value = "URI to redirect user back to after user is done adding brokerage connections") + + public String getRedirectUri() { + return redirectUri; + } + + + public void setRedirectUri(String redirectUri) { + + + + this.redirectUri = redirectUri; + } + + + public PartnerData allowedBrokerages(List allowedBrokerages) { + + + + + this.allowedBrokerages = allowedBrokerages; + return this; + } + + public PartnerData addAllowedBrokeragesItem(Brokerage allowedBrokeragesItem) { + if (this.allowedBrokerages == null) { + this.allowedBrokerages = new ArrayList<>(); + } + this.allowedBrokerages.add(allowedBrokeragesItem); + return this; + } + + /** + * Brokerages that can be accessed by partners + * @return allowedBrokerages + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Brokerages that can be accessed by partners") + + public List getAllowedBrokerages() { + return allowedBrokerages; + } + + + public void setAllowedBrokerages(List allowedBrokerages) { + + + + this.allowedBrokerages = allowedBrokerages; + } + + + public PartnerData name(String name) { + + + + + this.name = name; + return this; + } + + /** + * Name of Snaptrade Partner + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Wealthy Chimpmunk", value = "Name of Snaptrade Partner") + + public String getName() { + return name; + } + + + public void setName(String name) { + + + + this.name = name; + } + + + public PartnerData slug(String slug) { + + + + + this.slug = slug; + return this; + } + + /** + * Slug of Snaptrade Partner + * @return slug + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "WEALTHYCHIPMUNK", value = "Slug of Snaptrade Partner") + + public String getSlug() { + return slug; + } + + + public void setSlug(String slug) { + + + + this.slug = slug; + } + + + public PartnerData logoUrl(String logoUrl) { + + + + + this.logoUrl = logoUrl; + return this; + } + + /** + * URL to partner's logo + * @return logoUrl + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "https://example.com/logo.png", value = "URL to partner's logo") + + public String getLogoUrl() { + return logoUrl; + } + + + public void setLogoUrl(String logoUrl) { + + + + this.logoUrl = logoUrl; + } + + + public PartnerData pinRequired(Boolean pinRequired) { + + + + + this.pinRequired = pinRequired; + return this; + } + + /** + * Shows if pin is required by users to access connection page + * @return pinRequired + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "false", value = "Shows if pin is required by users to access connection page") + + public Boolean getPinRequired() { + return pinRequired; + } + + + public void setPinRequired(Boolean pinRequired) { + + + + this.pinRequired = pinRequired; + } + + + public PartnerData canAccessTrades(Boolean canAccessTrades) { + + + + + this.canAccessTrades = canAccessTrades; + return this; + } + + /** + * Shows if users of Snaptrade partners can access trade endpoints + * @return canAccessTrades + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "true", value = "Shows if users of Snaptrade partners can access trade endpoints") + + public Boolean getCanAccessTrades() { + return canAccessTrades; + } + + + public void setCanAccessTrades(Boolean canAccessTrades) { + + + + this.canAccessTrades = canAccessTrades; + } + + + public PartnerData canAccessHoldings(Boolean canAccessHoldings) { + + + + + this.canAccessHoldings = canAccessHoldings; + return this; + } + + /** + * Shows if Snaptrade partners can get user holdings data + * @return canAccessHoldings + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "true", value = "Shows if Snaptrade partners can get user holdings data") + + public Boolean getCanAccessHoldings() { + return canAccessHoldings; + } + + + public void setCanAccessHoldings(Boolean canAccessHoldings) { + + + + this.canAccessHoldings = canAccessHoldings; + } + + + public PartnerData canAccessAccountHistory(Boolean canAccessAccountHistory) { + + + + + this.canAccessAccountHistory = canAccessAccountHistory; + return this; + } + + /** + * Shows if Snaptrade partners can get users account history data + * @return canAccessAccountHistory + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "true", value = "Shows if Snaptrade partners can get users account history data") + + public Boolean getCanAccessAccountHistory() { + return canAccessAccountHistory; + } + + + public void setCanAccessAccountHistory(Boolean canAccessAccountHistory) { + + + + this.canAccessAccountHistory = canAccessAccountHistory; + } + + + public PartnerData canAccessReferenceData(Boolean canAccessReferenceData) { + + + + + this.canAccessReferenceData = canAccessReferenceData; + return this; + } + + /** + * Shows if Snaptrade partners can get users holdings data + * @return canAccessReferenceData + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "true", value = "Shows if Snaptrade partners can get users holdings data") + + public Boolean getCanAccessReferenceData() { + return canAccessReferenceData; + } + + + public void setCanAccessReferenceData(Boolean canAccessReferenceData) { + + + + this.canAccessReferenceData = canAccessReferenceData; + } + + + public PartnerData canAccessPortfolioManagement(Boolean canAccessPortfolioManagement) { + + + + + this.canAccessPortfolioManagement = canAccessPortfolioManagement; + return this; + } + + /** + * Shows if users Snaptrade partners can access portfolio group management features + * @return canAccessPortfolioManagement + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "true", value = "Shows if users Snaptrade partners can access portfolio group management features") + + public Boolean getCanAccessPortfolioManagement() { + return canAccessPortfolioManagement; + } + + + public void setCanAccessPortfolioManagement(Boolean canAccessPortfolioManagement) { + + + + this.canAccessPortfolioManagement = canAccessPortfolioManagement; + } + + + public PartnerData canAccessOrders(Boolean canAccessOrders) { + + + + + this.canAccessOrders = canAccessOrders; + return this; + } + + /** + * Shows if Snaptrade partners can get users account order history + * @return canAccessOrders + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "true", value = "Shows if Snaptrade partners can get users account order history") + + public Boolean getCanAccessOrders() { + return canAccessOrders; + } + + + public void setCanAccessOrders(Boolean canAccessOrders) { + + + + this.canAccessOrders = canAccessOrders; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PartnerData instance itself + */ + public PartnerData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PartnerData partnerData = (PartnerData) o; + return Objects.equals(this.redirectUri, partnerData.redirectUri) && + Objects.equals(this.allowedBrokerages, partnerData.allowedBrokerages) && + Objects.equals(this.name, partnerData.name) && + Objects.equals(this.slug, partnerData.slug) && + Objects.equals(this.logoUrl, partnerData.logoUrl) && + Objects.equals(this.pinRequired, partnerData.pinRequired) && + Objects.equals(this.canAccessTrades, partnerData.canAccessTrades) && + Objects.equals(this.canAccessHoldings, partnerData.canAccessHoldings) && + Objects.equals(this.canAccessAccountHistory, partnerData.canAccessAccountHistory) && + Objects.equals(this.canAccessReferenceData, partnerData.canAccessReferenceData) && + Objects.equals(this.canAccessPortfolioManagement, partnerData.canAccessPortfolioManagement) && + Objects.equals(this.canAccessOrders, partnerData.canAccessOrders)&& + Objects.equals(this.additionalProperties, partnerData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(redirectUri, allowedBrokerages, name, slug, logoUrl, pinRequired, canAccessTrades, canAccessHoldings, canAccessAccountHistory, canAccessReferenceData, canAccessPortfolioManagement, canAccessOrders, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PartnerData {\n"); + sb.append(" redirectUri: ").append(toIndentedString(redirectUri)).append("\n"); + sb.append(" allowedBrokerages: ").append(toIndentedString(allowedBrokerages)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); + sb.append(" logoUrl: ").append(toIndentedString(logoUrl)).append("\n"); + sb.append(" pinRequired: ").append(toIndentedString(pinRequired)).append("\n"); + sb.append(" canAccessTrades: ").append(toIndentedString(canAccessTrades)).append("\n"); + sb.append(" canAccessHoldings: ").append(toIndentedString(canAccessHoldings)).append("\n"); + sb.append(" canAccessAccountHistory: ").append(toIndentedString(canAccessAccountHistory)).append("\n"); + sb.append(" canAccessReferenceData: ").append(toIndentedString(canAccessReferenceData)).append("\n"); + sb.append(" canAccessPortfolioManagement: ").append(toIndentedString(canAccessPortfolioManagement)).append("\n"); + sb.append(" canAccessOrders: ").append(toIndentedString(canAccessOrders)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("redirect_uri"); + openapiFields.add("allowed_brokerages"); + openapiFields.add("name"); + openapiFields.add("slug"); + openapiFields.add("logo_url"); + openapiFields.add("pin_required"); + openapiFields.add("can_access_trades"); + openapiFields.add("can_access_holdings"); + openapiFields.add("can_access_account_history"); + openapiFields.add("can_access_reference_data"); + openapiFields.add("can_access_portfolio_management"); + openapiFields.add("can_access_orders"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to PartnerData + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!PartnerData.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PartnerData is not found in the empty JSON string", PartnerData.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("redirect_uri") != null && !jsonObj.get("redirect_uri").isJsonNull()) && !jsonObj.get("redirect_uri").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `redirect_uri` to be a primitive type in the JSON string but got `%s`", jsonObj.get("redirect_uri").toString())); + } + if (jsonObj.get("allowed_brokerages") != null && !jsonObj.get("allowed_brokerages").isJsonNull()) { + JsonArray jsonArrayallowedBrokerages = jsonObj.getAsJsonArray("allowed_brokerages"); + if (jsonArrayallowedBrokerages != null) { + // ensure the json data is an array + if (!jsonObj.get("allowed_brokerages").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `allowed_brokerages` to be an array in the JSON string but got `%s`", jsonObj.get("allowed_brokerages").toString())); + } + + // validate the optional field `allowed_brokerages` (array) + for (int i = 0; i < jsonArrayallowedBrokerages.size(); i++) { + Brokerage.validateJsonObject(jsonArrayallowedBrokerages.get(i).getAsJsonObject()); + }; + } + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("slug") != null && !jsonObj.get("slug").isJsonNull()) && !jsonObj.get("slug").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `slug` to be a primitive type in the JSON string but got `%s`", jsonObj.get("slug").toString())); + } + if ((jsonObj.get("logo_url") != null && !jsonObj.get("logo_url").isJsonNull()) && !jsonObj.get("logo_url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `logo_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("logo_url").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PartnerData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PartnerData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PartnerData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PartnerData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public PartnerData read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + PartnerData instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PartnerData given an JSON string + * + * @param jsonString JSON string + * @return An instance of PartnerData + * @throws IOException if the JSON string is invalid with respect to PartnerData + */ + public static PartnerData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PartnerData.class); + } + + /** + * Convert an instance of PartnerData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/PastValue.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/PastValue.java new file mode 100644 index 0000000000..fe8ce7889b --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/PastValue.java @@ -0,0 +1,372 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.time.LocalDate; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * PastValue + */@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class PastValue { + public static final String SERIALIZED_NAME_DATE = "date"; + @SerializedName(SERIALIZED_NAME_DATE) + private LocalDate date; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + private Double value; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + private String currency; + + public PastValue() { + } + + public PastValue date(LocalDate date) { + + + + + this.date = date; + return this; + } + + /** + * Date used to specify timeframe for a reporting call (in YYYY-MM-DD format) + * @return date + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Sun Jan 23 16:00:00 PST 2022", value = "Date used to specify timeframe for a reporting call (in YYYY-MM-DD format)") + + public LocalDate getDate() { + return date; + } + + + public void setDate(LocalDate date) { + + + + this.date = date; + } + + + public PastValue value(Double value) { + + + + + this.value = value; + return this; + } + + public PastValue value(Integer value) { + + + + + this.value = value.doubleValue(); + return this; + } + + /** + * Get value + * @return value + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "52.74", value = "") + + public Double getValue() { + return value; + } + + + public void setValue(Double value) { + + + + this.value = value; + } + + + public PastValue currency(String currency) { + + + + + this.currency = currency; + return this; + } + + /** + * Get currency + * @return currency + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "CAD", value = "") + + public String getCurrency() { + return currency; + } + + + public void setCurrency(String currency) { + + + + this.currency = currency; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PastValue instance itself + */ + public PastValue putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PastValue pastValue = (PastValue) o; + return Objects.equals(this.date, pastValue.date) && + Objects.equals(this.value, pastValue.value) && + Objects.equals(this.currency, pastValue.currency)&& + Objects.equals(this.additionalProperties, pastValue.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(date, value, currency, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PastValue {\n"); + sb.append(" date: ").append(toIndentedString(date)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("date"); + openapiFields.add("value"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to PastValue + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!PastValue.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PastValue is not found in the empty JSON string", PastValue.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) && !jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PastValue.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PastValue' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PastValue.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PastValue value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public PastValue read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + PastValue instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PastValue given an JSON string + * + * @param jsonString JSON string + * @return An instance of PastValue + * @throws IOException if the JSON string is invalid with respect to PastValue + */ + public static PastValue fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PastValue.class); + } + + /** + * Convert an instance of PastValue to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/PerformanceCustom.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/PerformanceCustom.java new file mode 100644 index 0000000000..730548c59c --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/PerformanceCustom.java @@ -0,0 +1,1206 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.MonthlyDividends; +import com.konfigthis.client.model.NetContributions; +import com.konfigthis.client.model.NetDividend; +import com.konfigthis.client.model.PastValue; +import com.konfigthis.client.model.SubPeriodReturnRate; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Performance Custom Response Object + */ +@ApiModel(description = "Performance Custom Response Object")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class PerformanceCustom { + public static final String SERIALIZED_NAME_TOTAL_EQUITY_TIMEFRAME = "totalEquityTimeframe"; + @SerializedName(SERIALIZED_NAME_TOTAL_EQUITY_TIMEFRAME) + private List totalEquityTimeframe = null; + + public static final String SERIALIZED_NAME_CONTRIBUTIONS = "contributions"; + @SerializedName(SERIALIZED_NAME_CONTRIBUTIONS) + private NetContributions contributions; + + public static final String SERIALIZED_NAME_CONTRIBUTION_TIMEFRAME = "contributionTimeframe"; + @SerializedName(SERIALIZED_NAME_CONTRIBUTION_TIMEFRAME) + private List contributionTimeframe = null; + + public static final String SERIALIZED_NAME_CONTRIBUTION_TIMEFRAME_CUMULATIVE = "contributionTimeframeCumulative"; + @SerializedName(SERIALIZED_NAME_CONTRIBUTION_TIMEFRAME_CUMULATIVE) + private List contributionTimeframeCumulative = null; + + public static final String SERIALIZED_NAME_WITHDRAWAL_TIMEFRAME = "withdrawalTimeframe"; + @SerializedName(SERIALIZED_NAME_WITHDRAWAL_TIMEFRAME) + private List withdrawalTimeframe = null; + + public static final String SERIALIZED_NAME_CONTRIBUTION_STREAK = "contributionStreak"; + @SerializedName(SERIALIZED_NAME_CONTRIBUTION_STREAK) + private Double contributionStreak; + + public static final String SERIALIZED_NAME_CONTRIBUTION_MONTHS_CONTRIBUTED = "contributionMonthsContributed"; + @SerializedName(SERIALIZED_NAME_CONTRIBUTION_MONTHS_CONTRIBUTED) + private Double contributionMonthsContributed; + + public static final String SERIALIZED_NAME_CONTRIBUTION_TOTAL_MONTHS = "contributionTotalMonths"; + @SerializedName(SERIALIZED_NAME_CONTRIBUTION_TOTAL_MONTHS) + private Double contributionTotalMonths; + + public static final String SERIALIZED_NAME_DIVIDENDS = "dividends"; + @SerializedName(SERIALIZED_NAME_DIVIDENDS) + private List dividends = null; + + public static final String SERIALIZED_NAME_DIVIDEND_INCOME = "dividendIncome"; + @SerializedName(SERIALIZED_NAME_DIVIDEND_INCOME) + private Double dividendIncome; + + public static final String SERIALIZED_NAME_MONTHLY_DIVIDENDS = "monthlyDividends"; + @SerializedName(SERIALIZED_NAME_MONTHLY_DIVIDENDS) + private Double monthlyDividends; + + public static final String SERIALIZED_NAME_BAD_TICKERS = "badTickers"; + @SerializedName(SERIALIZED_NAME_BAD_TICKERS) + private List badTickers = null; + + public static final String SERIALIZED_NAME_DIVIDEND_TIMELINE = "dividendTimeline"; + @SerializedName(SERIALIZED_NAME_DIVIDEND_TIMELINE) + private List dividendTimeline = null; + + public static final String SERIALIZED_NAME_COMMISSIONS = "commissions"; + @SerializedName(SERIALIZED_NAME_COMMISSIONS) + private Double commissions; + + public static final String SERIALIZED_NAME_FOREX_FEES = "forexFees"; + @SerializedName(SERIALIZED_NAME_FOREX_FEES) + private Double forexFees; + + public static final String SERIALIZED_NAME_FEES = "fees"; + @SerializedName(SERIALIZED_NAME_FEES) + private Double fees; + + public static final String SERIALIZED_NAME_RATE_OF_RETURN = "rateOfReturn"; + @SerializedName(SERIALIZED_NAME_RATE_OF_RETURN) + private Double rateOfReturn; + + public static final String SERIALIZED_NAME_RETURN_RATE_TIMEFRAME = "returnRateTimeframe"; + @SerializedName(SERIALIZED_NAME_RETURN_RATE_TIMEFRAME) + private List returnRateTimeframe = null; + + public static final String SERIALIZED_NAME_DETAILED_MODE = "detailedMode"; + @SerializedName(SERIALIZED_NAME_DETAILED_MODE) + private Boolean detailedMode; + + public PerformanceCustom() { + } + + public PerformanceCustom totalEquityTimeframe(List totalEquityTimeframe) { + + + + + this.totalEquityTimeframe = totalEquityTimeframe; + return this; + } + + public PerformanceCustom addTotalEquityTimeframeItem(PastValue totalEquityTimeframeItem) { + if (this.totalEquityTimeframe == null) { + this.totalEquityTimeframe = new ArrayList<>(); + } + this.totalEquityTimeframe.add(totalEquityTimeframeItem); + return this; + } + + /** + * Get totalEquityTimeframe + * @return totalEquityTimeframe + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public List getTotalEquityTimeframe() { + return totalEquityTimeframe; + } + + + public void setTotalEquityTimeframe(List totalEquityTimeframe) { + + + + this.totalEquityTimeframe = totalEquityTimeframe; + } + + + public PerformanceCustom contributions(NetContributions contributions) { + + + + + this.contributions = contributions; + return this; + } + + /** + * Get contributions + * @return contributions + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public NetContributions getContributions() { + return contributions; + } + + + public void setContributions(NetContributions contributions) { + + + + this.contributions = contributions; + } + + + public PerformanceCustom contributionTimeframe(List contributionTimeframe) { + + + + + this.contributionTimeframe = contributionTimeframe; + return this; + } + + public PerformanceCustom addContributionTimeframeItem(PastValue contributionTimeframeItem) { + if (this.contributionTimeframe == null) { + this.contributionTimeframe = new ArrayList<>(); + } + this.contributionTimeframe.add(contributionTimeframeItem); + return this; + } + + /** + * Get contributionTimeframe + * @return contributionTimeframe + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public List getContributionTimeframe() { + return contributionTimeframe; + } + + + public void setContributionTimeframe(List contributionTimeframe) { + + + + this.contributionTimeframe = contributionTimeframe; + } + + + public PerformanceCustom contributionTimeframeCumulative(List contributionTimeframeCumulative) { + + + + + this.contributionTimeframeCumulative = contributionTimeframeCumulative; + return this; + } + + public PerformanceCustom addContributionTimeframeCumulativeItem(PastValue contributionTimeframeCumulativeItem) { + if (this.contributionTimeframeCumulative == null) { + this.contributionTimeframeCumulative = new ArrayList<>(); + } + this.contributionTimeframeCumulative.add(contributionTimeframeCumulativeItem); + return this; + } + + /** + * Get contributionTimeframeCumulative + * @return contributionTimeframeCumulative + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public List getContributionTimeframeCumulative() { + return contributionTimeframeCumulative; + } + + + public void setContributionTimeframeCumulative(List contributionTimeframeCumulative) { + + + + this.contributionTimeframeCumulative = contributionTimeframeCumulative; + } + + + public PerformanceCustom withdrawalTimeframe(List withdrawalTimeframe) { + + + + + this.withdrawalTimeframe = withdrawalTimeframe; + return this; + } + + public PerformanceCustom addWithdrawalTimeframeItem(PastValue withdrawalTimeframeItem) { + if (this.withdrawalTimeframe == null) { + this.withdrawalTimeframe = new ArrayList<>(); + } + this.withdrawalTimeframe.add(withdrawalTimeframeItem); + return this; + } + + /** + * Get withdrawalTimeframe + * @return withdrawalTimeframe + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public List getWithdrawalTimeframe() { + return withdrawalTimeframe; + } + + + public void setWithdrawalTimeframe(List withdrawalTimeframe) { + + + + this.withdrawalTimeframe = withdrawalTimeframe; + } + + + public PerformanceCustom contributionStreak(Double contributionStreak) { + + + + + this.contributionStreak = contributionStreak; + return this; + } + + public PerformanceCustom contributionStreak(Integer contributionStreak) { + + + + + this.contributionStreak = contributionStreak.doubleValue(); + return this; + } + + /** + * Current streak of cosecutive months where contributions were made + * @return contributionStreak + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "5", value = "Current streak of cosecutive months where contributions were made") + + public Double getContributionStreak() { + return contributionStreak; + } + + + public void setContributionStreak(Double contributionStreak) { + + + + this.contributionStreak = contributionStreak; + } + + + public PerformanceCustom contributionMonthsContributed(Double contributionMonthsContributed) { + + + + + this.contributionMonthsContributed = contributionMonthsContributed; + return this; + } + + public PerformanceCustom contributionMonthsContributed(Integer contributionMonthsContributed) { + + + + + this.contributionMonthsContributed = contributionMonthsContributed.doubleValue(); + return this; + } + + /** + * Number of months in the timeframe with contributions + * @return contributionMonthsContributed + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "10", value = "Number of months in the timeframe with contributions") + + public Double getContributionMonthsContributed() { + return contributionMonthsContributed; + } + + + public void setContributionMonthsContributed(Double contributionMonthsContributed) { + + + + this.contributionMonthsContributed = contributionMonthsContributed; + } + + + public PerformanceCustom contributionTotalMonths(Double contributionTotalMonths) { + + + + + this.contributionTotalMonths = contributionTotalMonths; + return this; + } + + public PerformanceCustom contributionTotalMonths(Integer contributionTotalMonths) { + + + + + this.contributionTotalMonths = contributionTotalMonths.doubleValue(); + return this; + } + + /** + * Total months in timeframe + * @return contributionTotalMonths + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "13", value = "Total months in timeframe") + + public Double getContributionTotalMonths() { + return contributionTotalMonths; + } + + + public void setContributionTotalMonths(Double contributionTotalMonths) { + + + + this.contributionTotalMonths = contributionTotalMonths; + } + + + public PerformanceCustom dividends(List dividends) { + + + + + this.dividends = dividends; + return this; + } + + public PerformanceCustom addDividendsItem(NetDividend dividendsItem) { + if (this.dividends == null) { + this.dividends = new ArrayList<>(); + } + this.dividends.add(dividendsItem); + return this; + } + + /** + * Get dividends + * @return dividends + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public List getDividends() { + return dividends; + } + + + public void setDividends(List dividends) { + + + + this.dividends = dividends; + } + + + public PerformanceCustom dividendIncome(Double dividendIncome) { + + + + + this.dividendIncome = dividendIncome; + return this; + } + + public PerformanceCustom dividendIncome(Integer dividendIncome) { + + + + + this.dividendIncome = dividendIncome.doubleValue(); + return this; + } + + /** + * Total dividends received over the timeframe + * @return dividendIncome + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "135.97", value = "Total dividends received over the timeframe") + + public Double getDividendIncome() { + return dividendIncome; + } + + + public void setDividendIncome(Double dividendIncome) { + + + + this.dividendIncome = dividendIncome; + } + + + public PerformanceCustom monthlyDividends(Double monthlyDividends) { + + + + + this.monthlyDividends = monthlyDividends; + return this; + } + + public PerformanceCustom monthlyDividends(Integer monthlyDividends) { + + + + + this.monthlyDividends = monthlyDividends.doubleValue(); + return this; + } + + /** + * Average dividends received per month over the timeframe + * @return monthlyDividends + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "26.37", value = "Average dividends received per month over the timeframe") + + public Double getMonthlyDividends() { + return monthlyDividends; + } + + + public void setMonthlyDividends(Double monthlyDividends) { + + + + this.monthlyDividends = monthlyDividends; + } + + + public PerformanceCustom badTickers(List badTickers) { + + + + + this.badTickers = badTickers; + return this; + } + + public PerformanceCustom addBadTickersItem(String badTickersItem) { + if (this.badTickers == null) { + this.badTickers = new ArrayList<>(); + } + this.badTickers.add(badTickersItem); + return this; + } + + /** + * list of tickers which may not be supported or may not have accurate price data + * @return badTickers + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "list of tickers which may not be supported or may not have accurate price data") + + public List getBadTickers() { + return badTickers; + } + + + public void setBadTickers(List badTickers) { + + + + this.badTickers = badTickers; + } + + + public PerformanceCustom dividendTimeline(List dividendTimeline) { + + + + + this.dividendTimeline = dividendTimeline; + return this; + } + + public PerformanceCustom addDividendTimelineItem(MonthlyDividends dividendTimelineItem) { + if (this.dividendTimeline == null) { + this.dividendTimeline = new ArrayList<>(); + } + this.dividendTimeline.add(dividendTimelineItem); + return this; + } + + /** + * Get dividendTimeline + * @return dividendTimeline + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public List getDividendTimeline() { + return dividendTimeline; + } + + + public void setDividendTimeline(List dividendTimeline) { + + + + this.dividendTimeline = dividendTimeline; + } + + + public PerformanceCustom commissions(Double commissions) { + + + + + this.commissions = commissions; + return this; + } + + public PerformanceCustom commissions(Integer commissions) { + + + + + this.commissions = commissions.doubleValue(); + return this; + } + + /** + * commissions incurred during the timeframe + * @return commissions + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "3.26", value = "commissions incurred during the timeframe") + + public Double getCommissions() { + return commissions; + } + + + public void setCommissions(Double commissions) { + + + + this.commissions = commissions; + } + + + public PerformanceCustom forexFees(Double forexFees) { + + + + + this.forexFees = forexFees; + return this; + } + + public PerformanceCustom forexFees(Integer forexFees) { + + + + + this.forexFees = forexFees.doubleValue(); + return this; + } + + /** + * forex fees incurred during the timeframe + * @return forexFees + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "5.26", value = "forex fees incurred during the timeframe") + + public Double getForexFees() { + return forexFees; + } + + + public void setForexFees(Double forexFees) { + + + + this.forexFees = forexFees; + } + + + public PerformanceCustom fees(Double fees) { + + + + + this.fees = fees; + return this; + } + + public PerformanceCustom fees(Integer fees) { + + + + + this.fees = fees.doubleValue(); + return this; + } + + /** + * other fees incurred during the timeframe + * @return fees + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2.72", value = "other fees incurred during the timeframe") + + public Double getFees() { + return fees; + } + + + public void setFees(Double fees) { + + + + this.fees = fees; + } + + + public PerformanceCustom rateOfReturn(Double rateOfReturn) { + + + + + this.rateOfReturn = rateOfReturn; + return this; + } + + public PerformanceCustom rateOfReturn(Integer rateOfReturn) { + + + + + this.rateOfReturn = rateOfReturn.doubleValue(); + return this; + } + + /** + * The return rate over the timeframe. Annualized if timeframe is longer than 1 year + * @return rateOfReturn + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "0.082312367452", value = "The return rate over the timeframe. Annualized if timeframe is longer than 1 year") + + public Double getRateOfReturn() { + return rateOfReturn; + } + + + public void setRateOfReturn(Double rateOfReturn) { + + + + this.rateOfReturn = rateOfReturn; + } + + + public PerformanceCustom returnRateTimeframe(List returnRateTimeframe) { + + + + + this.returnRateTimeframe = returnRateTimeframe; + return this; + } + + public PerformanceCustom addReturnRateTimeframeItem(SubPeriodReturnRate returnRateTimeframeItem) { + if (this.returnRateTimeframe == null) { + this.returnRateTimeframe = new ArrayList<>(); + } + this.returnRateTimeframe.add(returnRateTimeframeItem); + return this; + } + + /** + * Get returnRateTimeframe + * @return returnRateTimeframe + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public List getReturnRateTimeframe() { + return returnRateTimeframe; + } + + + public void setReturnRateTimeframe(List returnRateTimeframe) { + + + + this.returnRateTimeframe = returnRateTimeframe; + } + + + public PerformanceCustom detailedMode(Boolean detailedMode) { + + + + + this.detailedMode = detailedMode; + return this; + } + + /** + * Whether the user has detailed mode enabled (more frequent data points for totalEquity and contribution timeframes) + * @return detailedMode + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Whether the user has detailed mode enabled (more frequent data points for totalEquity and contribution timeframes)") + + public Boolean getDetailedMode() { + return detailedMode; + } + + + public void setDetailedMode(Boolean detailedMode) { + + + + this.detailedMode = detailedMode; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PerformanceCustom instance itself + */ + public PerformanceCustom putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PerformanceCustom performanceCustom = (PerformanceCustom) o; + return Objects.equals(this.totalEquityTimeframe, performanceCustom.totalEquityTimeframe) && + Objects.equals(this.contributions, performanceCustom.contributions) && + Objects.equals(this.contributionTimeframe, performanceCustom.contributionTimeframe) && + Objects.equals(this.contributionTimeframeCumulative, performanceCustom.contributionTimeframeCumulative) && + Objects.equals(this.withdrawalTimeframe, performanceCustom.withdrawalTimeframe) && + Objects.equals(this.contributionStreak, performanceCustom.contributionStreak) && + Objects.equals(this.contributionMonthsContributed, performanceCustom.contributionMonthsContributed) && + Objects.equals(this.contributionTotalMonths, performanceCustom.contributionTotalMonths) && + Objects.equals(this.dividends, performanceCustom.dividends) && + Objects.equals(this.dividendIncome, performanceCustom.dividendIncome) && + Objects.equals(this.monthlyDividends, performanceCustom.monthlyDividends) && + Objects.equals(this.badTickers, performanceCustom.badTickers) && + Objects.equals(this.dividendTimeline, performanceCustom.dividendTimeline) && + Objects.equals(this.commissions, performanceCustom.commissions) && + Objects.equals(this.forexFees, performanceCustom.forexFees) && + Objects.equals(this.fees, performanceCustom.fees) && + Objects.equals(this.rateOfReturn, performanceCustom.rateOfReturn) && + Objects.equals(this.returnRateTimeframe, performanceCustom.returnRateTimeframe) && + Objects.equals(this.detailedMode, performanceCustom.detailedMode)&& + Objects.equals(this.additionalProperties, performanceCustom.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(totalEquityTimeframe, contributions, contributionTimeframe, contributionTimeframeCumulative, withdrawalTimeframe, contributionStreak, contributionMonthsContributed, contributionTotalMonths, dividends, dividendIncome, monthlyDividends, badTickers, dividendTimeline, commissions, forexFees, fees, rateOfReturn, returnRateTimeframe, detailedMode, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PerformanceCustom {\n"); + sb.append(" totalEquityTimeframe: ").append(toIndentedString(totalEquityTimeframe)).append("\n"); + sb.append(" contributions: ").append(toIndentedString(contributions)).append("\n"); + sb.append(" contributionTimeframe: ").append(toIndentedString(contributionTimeframe)).append("\n"); + sb.append(" contributionTimeframeCumulative: ").append(toIndentedString(contributionTimeframeCumulative)).append("\n"); + sb.append(" withdrawalTimeframe: ").append(toIndentedString(withdrawalTimeframe)).append("\n"); + sb.append(" contributionStreak: ").append(toIndentedString(contributionStreak)).append("\n"); + sb.append(" contributionMonthsContributed: ").append(toIndentedString(contributionMonthsContributed)).append("\n"); + sb.append(" contributionTotalMonths: ").append(toIndentedString(contributionTotalMonths)).append("\n"); + sb.append(" dividends: ").append(toIndentedString(dividends)).append("\n"); + sb.append(" dividendIncome: ").append(toIndentedString(dividendIncome)).append("\n"); + sb.append(" monthlyDividends: ").append(toIndentedString(monthlyDividends)).append("\n"); + sb.append(" badTickers: ").append(toIndentedString(badTickers)).append("\n"); + sb.append(" dividendTimeline: ").append(toIndentedString(dividendTimeline)).append("\n"); + sb.append(" commissions: ").append(toIndentedString(commissions)).append("\n"); + sb.append(" forexFees: ").append(toIndentedString(forexFees)).append("\n"); + sb.append(" fees: ").append(toIndentedString(fees)).append("\n"); + sb.append(" rateOfReturn: ").append(toIndentedString(rateOfReturn)).append("\n"); + sb.append(" returnRateTimeframe: ").append(toIndentedString(returnRateTimeframe)).append("\n"); + sb.append(" detailedMode: ").append(toIndentedString(detailedMode)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("totalEquityTimeframe"); + openapiFields.add("contributions"); + openapiFields.add("contributionTimeframe"); + openapiFields.add("contributionTimeframeCumulative"); + openapiFields.add("withdrawalTimeframe"); + openapiFields.add("contributionStreak"); + openapiFields.add("contributionMonthsContributed"); + openapiFields.add("contributionTotalMonths"); + openapiFields.add("dividends"); + openapiFields.add("dividendIncome"); + openapiFields.add("monthlyDividends"); + openapiFields.add("badTickers"); + openapiFields.add("dividendTimeline"); + openapiFields.add("commissions"); + openapiFields.add("forexFees"); + openapiFields.add("fees"); + openapiFields.add("rateOfReturn"); + openapiFields.add("returnRateTimeframe"); + openapiFields.add("detailedMode"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to PerformanceCustom + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!PerformanceCustom.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PerformanceCustom is not found in the empty JSON string", PerformanceCustom.openapiRequiredFields.toString())); + } + } + if (jsonObj.get("totalEquityTimeframe") != null && !jsonObj.get("totalEquityTimeframe").isJsonNull()) { + JsonArray jsonArraytotalEquityTimeframe = jsonObj.getAsJsonArray("totalEquityTimeframe"); + if (jsonArraytotalEquityTimeframe != null) { + // ensure the json data is an array + if (!jsonObj.get("totalEquityTimeframe").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `totalEquityTimeframe` to be an array in the JSON string but got `%s`", jsonObj.get("totalEquityTimeframe").toString())); + } + + // validate the optional field `totalEquityTimeframe` (array) + for (int i = 0; i < jsonArraytotalEquityTimeframe.size(); i++) { + PastValue.validateJsonObject(jsonArraytotalEquityTimeframe.get(i).getAsJsonObject()); + }; + } + } + // validate the optional field `contributions` + if (jsonObj.get("contributions") != null && !jsonObj.get("contributions").isJsonNull()) { + NetContributions.validateJsonObject(jsonObj.getAsJsonObject("contributions")); + } + if (jsonObj.get("contributionTimeframe") != null && !jsonObj.get("contributionTimeframe").isJsonNull()) { + JsonArray jsonArraycontributionTimeframe = jsonObj.getAsJsonArray("contributionTimeframe"); + if (jsonArraycontributionTimeframe != null) { + // ensure the json data is an array + if (!jsonObj.get("contributionTimeframe").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `contributionTimeframe` to be an array in the JSON string but got `%s`", jsonObj.get("contributionTimeframe").toString())); + } + + // validate the optional field `contributionTimeframe` (array) + for (int i = 0; i < jsonArraycontributionTimeframe.size(); i++) { + PastValue.validateJsonObject(jsonArraycontributionTimeframe.get(i).getAsJsonObject()); + }; + } + } + if (jsonObj.get("contributionTimeframeCumulative") != null && !jsonObj.get("contributionTimeframeCumulative").isJsonNull()) { + JsonArray jsonArraycontributionTimeframeCumulative = jsonObj.getAsJsonArray("contributionTimeframeCumulative"); + if (jsonArraycontributionTimeframeCumulative != null) { + // ensure the json data is an array + if (!jsonObj.get("contributionTimeframeCumulative").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `contributionTimeframeCumulative` to be an array in the JSON string but got `%s`", jsonObj.get("contributionTimeframeCumulative").toString())); + } + + // validate the optional field `contributionTimeframeCumulative` (array) + for (int i = 0; i < jsonArraycontributionTimeframeCumulative.size(); i++) { + PastValue.validateJsonObject(jsonArraycontributionTimeframeCumulative.get(i).getAsJsonObject()); + }; + } + } + if (jsonObj.get("withdrawalTimeframe") != null && !jsonObj.get("withdrawalTimeframe").isJsonNull()) { + JsonArray jsonArraywithdrawalTimeframe = jsonObj.getAsJsonArray("withdrawalTimeframe"); + if (jsonArraywithdrawalTimeframe != null) { + // ensure the json data is an array + if (!jsonObj.get("withdrawalTimeframe").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `withdrawalTimeframe` to be an array in the JSON string but got `%s`", jsonObj.get("withdrawalTimeframe").toString())); + } + + // validate the optional field `withdrawalTimeframe` (array) + for (int i = 0; i < jsonArraywithdrawalTimeframe.size(); i++) { + PastValue.validateJsonObject(jsonArraywithdrawalTimeframe.get(i).getAsJsonObject()); + }; + } + } + if (jsonObj.get("dividends") != null && !jsonObj.get("dividends").isJsonNull()) { + JsonArray jsonArraydividends = jsonObj.getAsJsonArray("dividends"); + if (jsonArraydividends != null) { + // ensure the json data is an array + if (!jsonObj.get("dividends").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `dividends` to be an array in the JSON string but got `%s`", jsonObj.get("dividends").toString())); + } + + // validate the optional field `dividends` (array) + for (int i = 0; i < jsonArraydividends.size(); i++) { + NetDividend.validateJsonObject(jsonArraydividends.get(i).getAsJsonObject()); + }; + } + } + // ensure the optional json data is an array if present + if (jsonObj.get("badTickers") != null && !jsonObj.get("badTickers").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `badTickers` to be an array in the JSON string but got `%s`", jsonObj.get("badTickers").toString())); + } + if (jsonObj.get("dividendTimeline") != null && !jsonObj.get("dividendTimeline").isJsonNull()) { + JsonArray jsonArraydividendTimeline = jsonObj.getAsJsonArray("dividendTimeline"); + if (jsonArraydividendTimeline != null) { + // ensure the json data is an array + if (!jsonObj.get("dividendTimeline").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `dividendTimeline` to be an array in the JSON string but got `%s`", jsonObj.get("dividendTimeline").toString())); + } + + // validate the optional field `dividendTimeline` (array) + for (int i = 0; i < jsonArraydividendTimeline.size(); i++) { + MonthlyDividends.validateJsonObject(jsonArraydividendTimeline.get(i).getAsJsonObject()); + }; + } + } + if (jsonObj.get("returnRateTimeframe") != null && !jsonObj.get("returnRateTimeframe").isJsonNull()) { + JsonArray jsonArrayreturnRateTimeframe = jsonObj.getAsJsonArray("returnRateTimeframe"); + if (jsonArrayreturnRateTimeframe != null) { + // ensure the json data is an array + if (!jsonObj.get("returnRateTimeframe").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `returnRateTimeframe` to be an array in the JSON string but got `%s`", jsonObj.get("returnRateTimeframe").toString())); + } + + // validate the optional field `returnRateTimeframe` (array) + for (int i = 0; i < jsonArrayreturnRateTimeframe.size(); i++) { + SubPeriodReturnRate.validateJsonObject(jsonArrayreturnRateTimeframe.get(i).getAsJsonObject()); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PerformanceCustom.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PerformanceCustom' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PerformanceCustom.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PerformanceCustom value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public PerformanceCustom read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + PerformanceCustom instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PerformanceCustom given an JSON string + * + * @param jsonString JSON string + * @return An instance of PerformanceCustom + * @throws IOException if the JSON string is invalid with respect to PerformanceCustom + */ + public static PerformanceCustom fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PerformanceCustom.class); + } + + /** + * Convert an instance of PerformanceCustom to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/PortfolioGroup.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/PortfolioGroup.java new file mode 100644 index 0000000000..e5d85a3bf6 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/PortfolioGroup.java @@ -0,0 +1,330 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * PortfolioGroup + */@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class PortfolioGroup { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private UUID id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public PortfolioGroup() { + } + + public PortfolioGroup id(UUID id) { + + + + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getId() { + return id; + } + + + public void setId(UUID id) { + + + + this.id = id; + } + + + public PortfolioGroup name(String name) { + + + + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Combined Retirement Portfolio", value = "") + + public String getName() { + return name; + } + + + public void setName(String name) { + + + + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PortfolioGroup instance itself + */ + public PortfolioGroup putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PortfolioGroup portfolioGroup = (PortfolioGroup) o; + return Objects.equals(this.id, portfolioGroup.id) && + Objects.equals(this.name, portfolioGroup.name)&& + Objects.equals(this.additionalProperties, portfolioGroup.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PortfolioGroup {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to PortfolioGroup + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!PortfolioGroup.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PortfolioGroup is not found in the empty JSON string", PortfolioGroup.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PortfolioGroup.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PortfolioGroup' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PortfolioGroup.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PortfolioGroup value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public PortfolioGroup read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + PortfolioGroup instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PortfolioGroup given an JSON string + * + * @param jsonString JSON string + * @return An instance of PortfolioGroup + * @throws IOException if the JSON string is invalid with respect to PortfolioGroup + */ + public static PortfolioGroup fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PortfolioGroup.class); + } + + /** + * Convert an instance of PortfolioGroup to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/PortfolioGroupInfo.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/PortfolioGroupInfo.java new file mode 100644 index 0000000000..46893339ec --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/PortfolioGroupInfo.java @@ -0,0 +1,869 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.Balance; +import com.konfigthis.client.model.BrokerageAuthorization; +import com.konfigthis.client.model.CalculatedTrade; +import com.konfigthis.client.model.ExcludedAsset; +import com.konfigthis.client.model.PortfolioGroupSettings; +import com.konfigthis.client.model.Position; +import com.konfigthis.client.model.TargetAsset; +import com.konfigthis.client.model.UniversalSymbol; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Summary of all relevant information about a portfolio group. + */ +@ApiModel(description = "Summary of all relevant information about a portfolio group.")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class PortfolioGroupInfo { + public static final String SERIALIZED_NAME_SYMBOLS = "symbols"; + @SerializedName(SERIALIZED_NAME_SYMBOLS) + private List symbols = null; + + public static final String SERIALIZED_NAME_QUOTABLE_SYMBOLS = "quotable_symbols"; + @SerializedName(SERIALIZED_NAME_QUOTABLE_SYMBOLS) + private List quotableSymbols = null; + + public static final String SERIALIZED_NAME_BALANCES = "balances"; + @SerializedName(SERIALIZED_NAME_BALANCES) + private List balances = null; + + public static final String SERIALIZED_NAME_POSITIONS = "positions"; + @SerializedName(SERIALIZED_NAME_POSITIONS) + private List positions = null; + + public static final String SERIALIZED_NAME_TARGET_POSITIONS = "target_positions"; + @SerializedName(SERIALIZED_NAME_TARGET_POSITIONS) + private List targetPositions = null; + + public static final String SERIALIZED_NAME_IDEAL_POSITIONS = "ideal_positions"; + @SerializedName(SERIALIZED_NAME_IDEAL_POSITIONS) + private List idealPositions = null; + + public static final String SERIALIZED_NAME_EXCLUDED_POSITIONS = "excluded_positions"; + @SerializedName(SERIALIZED_NAME_EXCLUDED_POSITIONS) + private List excludedPositions = null; + + public static final String SERIALIZED_NAME_CALCULATED_TRADES = "calculated_trades"; + @SerializedName(SERIALIZED_NAME_CALCULATED_TRADES) + private List calculatedTrades = null; + + public static final String SERIALIZED_NAME_BROKERAGE_AUTHORIZATIONS = "brokerage_authorizations"; + @SerializedName(SERIALIZED_NAME_BROKERAGE_AUTHORIZATIONS) + private List brokerageAuthorizations = null; + + public static final String SERIALIZED_NAME_ACCURACY = "accuracy"; + @SerializedName(SERIALIZED_NAME_ACCURACY) + private Double accuracy; + + public static final String SERIALIZED_NAME_SETTINGS = "settings"; + @SerializedName(SERIALIZED_NAME_SETTINGS) + private PortfolioGroupSettings settings; + + public PortfolioGroupInfo() { + } + + public PortfolioGroupInfo symbols(List symbols) { + + + + + this.symbols = symbols; + return this; + } + + public PortfolioGroupInfo addSymbolsItem(UniversalSymbol symbolsItem) { + if (this.symbols == null) { + this.symbols = new ArrayList<>(); + } + this.symbols.add(symbolsItem); + return this; + } + + /** + * Get symbols + * @return symbols + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public List getSymbols() { + return symbols; + } + + + public void setSymbols(List symbols) { + + + + this.symbols = symbols; + } + + + public PortfolioGroupInfo quotableSymbols(List quotableSymbols) { + + + + + this.quotableSymbols = quotableSymbols; + return this; + } + + public PortfolioGroupInfo addQuotableSymbolsItem(UniversalSymbol quotableSymbolsItem) { + if (this.quotableSymbols == null) { + this.quotableSymbols = new ArrayList<>(); + } + this.quotableSymbols.add(quotableSymbolsItem); + return this; + } + + /** + * Get quotableSymbols + * @return quotableSymbols + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public List getQuotableSymbols() { + return quotableSymbols; + } + + + public void setQuotableSymbols(List quotableSymbols) { + + + + this.quotableSymbols = quotableSymbols; + } + + + public PortfolioGroupInfo balances(List balances) { + + + + + this.balances = balances; + return this; + } + + public PortfolioGroupInfo addBalancesItem(Balance balancesItem) { + if (this.balances == null) { + this.balances = new ArrayList<>(); + } + this.balances.add(balancesItem); + return this; + } + + /** + * Get balances + * @return balances + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public List getBalances() { + return balances; + } + + + public void setBalances(List balances) { + + + + this.balances = balances; + } + + + public PortfolioGroupInfo positions(List positions) { + + + + + this.positions = positions; + return this; + } + + public PortfolioGroupInfo addPositionsItem(Position positionsItem) { + if (this.positions == null) { + this.positions = new ArrayList<>(); + } + this.positions.add(positionsItem); + return this; + } + + /** + * Get positions + * @return positions + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public List getPositions() { + return positions; + } + + + public void setPositions(List positions) { + + + + this.positions = positions; + } + + + public PortfolioGroupInfo targetPositions(List targetPositions) { + + + + + this.targetPositions = targetPositions; + return this; + } + + public PortfolioGroupInfo addTargetPositionsItem(TargetAsset targetPositionsItem) { + if (this.targetPositions == null) { + this.targetPositions = new ArrayList<>(); + } + this.targetPositions.add(targetPositionsItem); + return this; + } + + /** + * Get targetPositions + * @return targetPositions + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public List getTargetPositions() { + return targetPositions; + } + + + public void setTargetPositions(List targetPositions) { + + + + this.targetPositions = targetPositions; + } + + + public PortfolioGroupInfo idealPositions(List idealPositions) { + + + + + this.idealPositions = idealPositions; + return this; + } + + public PortfolioGroupInfo addIdealPositionsItem(Position idealPositionsItem) { + if (this.idealPositions == null) { + this.idealPositions = new ArrayList<>(); + } + this.idealPositions.add(idealPositionsItem); + return this; + } + + /** + * Get idealPositions + * @return idealPositions + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public List getIdealPositions() { + return idealPositions; + } + + + public void setIdealPositions(List idealPositions) { + + + + this.idealPositions = idealPositions; + } + + + public PortfolioGroupInfo excludedPositions(List excludedPositions) { + + + + + this.excludedPositions = excludedPositions; + return this; + } + + public PortfolioGroupInfo addExcludedPositionsItem(ExcludedAsset excludedPositionsItem) { + if (this.excludedPositions == null) { + this.excludedPositions = new ArrayList<>(); + } + this.excludedPositions.add(excludedPositionsItem); + return this; + } + + /** + * Get excludedPositions + * @return excludedPositions + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public List getExcludedPositions() { + return excludedPositions; + } + + + public void setExcludedPositions(List excludedPositions) { + + + + this.excludedPositions = excludedPositions; + } + + + public PortfolioGroupInfo calculatedTrades(List calculatedTrades) { + + + + + this.calculatedTrades = calculatedTrades; + return this; + } + + public PortfolioGroupInfo addCalculatedTradesItem(CalculatedTrade calculatedTradesItem) { + if (this.calculatedTrades == null) { + this.calculatedTrades = new ArrayList<>(); + } + this.calculatedTrades.add(calculatedTradesItem); + return this; + } + + /** + * Get calculatedTrades + * @return calculatedTrades + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public List getCalculatedTrades() { + return calculatedTrades; + } + + + public void setCalculatedTrades(List calculatedTrades) { + + + + this.calculatedTrades = calculatedTrades; + } + + + public PortfolioGroupInfo brokerageAuthorizations(List brokerageAuthorizations) { + + + + + this.brokerageAuthorizations = brokerageAuthorizations; + return this; + } + + public PortfolioGroupInfo addBrokerageAuthorizationsItem(BrokerageAuthorization brokerageAuthorizationsItem) { + if (this.brokerageAuthorizations == null) { + this.brokerageAuthorizations = new ArrayList<>(); + } + this.brokerageAuthorizations.add(brokerageAuthorizationsItem); + return this; + } + + /** + * Get brokerageAuthorizations + * @return brokerageAuthorizations + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public List getBrokerageAuthorizations() { + return brokerageAuthorizations; + } + + + public void setBrokerageAuthorizations(List brokerageAuthorizations) { + + + + this.brokerageAuthorizations = brokerageAuthorizations; + } + + + public PortfolioGroupInfo accuracy(Double accuracy) { + + + + + this.accuracy = accuracy; + return this; + } + + public PortfolioGroupInfo accuracy(Integer accuracy) { + + + + + this.accuracy = accuracy.doubleValue(); + return this; + } + + /** + * Get accuracy + * @return accuracy + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "0.962", value = "") + + public Double getAccuracy() { + return accuracy; + } + + + public void setAccuracy(Double accuracy) { + + + + this.accuracy = accuracy; + } + + + public PortfolioGroupInfo settings(PortfolioGroupSettings settings) { + + + + + this.settings = settings; + return this; + } + + /** + * Get settings + * @return settings + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public PortfolioGroupSettings getSettings() { + return settings; + } + + + public void setSettings(PortfolioGroupSettings settings) { + + + + this.settings = settings; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PortfolioGroupInfo instance itself + */ + public PortfolioGroupInfo putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PortfolioGroupInfo portfolioGroupInfo = (PortfolioGroupInfo) o; + return Objects.equals(this.symbols, portfolioGroupInfo.symbols) && + Objects.equals(this.quotableSymbols, portfolioGroupInfo.quotableSymbols) && + Objects.equals(this.balances, portfolioGroupInfo.balances) && + Objects.equals(this.positions, portfolioGroupInfo.positions) && + Objects.equals(this.targetPositions, portfolioGroupInfo.targetPositions) && + Objects.equals(this.idealPositions, portfolioGroupInfo.idealPositions) && + Objects.equals(this.excludedPositions, portfolioGroupInfo.excludedPositions) && + Objects.equals(this.calculatedTrades, portfolioGroupInfo.calculatedTrades) && + Objects.equals(this.brokerageAuthorizations, portfolioGroupInfo.brokerageAuthorizations) && + Objects.equals(this.accuracy, portfolioGroupInfo.accuracy) && + Objects.equals(this.settings, portfolioGroupInfo.settings)&& + Objects.equals(this.additionalProperties, portfolioGroupInfo.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(symbols, quotableSymbols, balances, positions, targetPositions, idealPositions, excludedPositions, calculatedTrades, brokerageAuthorizations, accuracy, settings, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PortfolioGroupInfo {\n"); + sb.append(" symbols: ").append(toIndentedString(symbols)).append("\n"); + sb.append(" quotableSymbols: ").append(toIndentedString(quotableSymbols)).append("\n"); + sb.append(" balances: ").append(toIndentedString(balances)).append("\n"); + sb.append(" positions: ").append(toIndentedString(positions)).append("\n"); + sb.append(" targetPositions: ").append(toIndentedString(targetPositions)).append("\n"); + sb.append(" idealPositions: ").append(toIndentedString(idealPositions)).append("\n"); + sb.append(" excludedPositions: ").append(toIndentedString(excludedPositions)).append("\n"); + sb.append(" calculatedTrades: ").append(toIndentedString(calculatedTrades)).append("\n"); + sb.append(" brokerageAuthorizations: ").append(toIndentedString(brokerageAuthorizations)).append("\n"); + sb.append(" accuracy: ").append(toIndentedString(accuracy)).append("\n"); + sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("symbols"); + openapiFields.add("quotable_symbols"); + openapiFields.add("balances"); + openapiFields.add("positions"); + openapiFields.add("target_positions"); + openapiFields.add("ideal_positions"); + openapiFields.add("excluded_positions"); + openapiFields.add("calculated_trades"); + openapiFields.add("brokerage_authorizations"); + openapiFields.add("accuracy"); + openapiFields.add("settings"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to PortfolioGroupInfo + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!PortfolioGroupInfo.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PortfolioGroupInfo is not found in the empty JSON string", PortfolioGroupInfo.openapiRequiredFields.toString())); + } + } + if (jsonObj.get("symbols") != null && !jsonObj.get("symbols").isJsonNull()) { + JsonArray jsonArraysymbols = jsonObj.getAsJsonArray("symbols"); + if (jsonArraysymbols != null) { + // ensure the json data is an array + if (!jsonObj.get("symbols").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `symbols` to be an array in the JSON string but got `%s`", jsonObj.get("symbols").toString())); + } + + // validate the optional field `symbols` (array) + for (int i = 0; i < jsonArraysymbols.size(); i++) { + UniversalSymbol.validateJsonObject(jsonArraysymbols.get(i).getAsJsonObject()); + }; + } + } + if (jsonObj.get("quotable_symbols") != null && !jsonObj.get("quotable_symbols").isJsonNull()) { + JsonArray jsonArrayquotableSymbols = jsonObj.getAsJsonArray("quotable_symbols"); + if (jsonArrayquotableSymbols != null) { + // ensure the json data is an array + if (!jsonObj.get("quotable_symbols").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `quotable_symbols` to be an array in the JSON string but got `%s`", jsonObj.get("quotable_symbols").toString())); + } + + // validate the optional field `quotable_symbols` (array) + for (int i = 0; i < jsonArrayquotableSymbols.size(); i++) { + UniversalSymbol.validateJsonObject(jsonArrayquotableSymbols.get(i).getAsJsonObject()); + }; + } + } + if (jsonObj.get("balances") != null && !jsonObj.get("balances").isJsonNull()) { + JsonArray jsonArraybalances = jsonObj.getAsJsonArray("balances"); + if (jsonArraybalances != null) { + // ensure the json data is an array + if (!jsonObj.get("balances").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `balances` to be an array in the JSON string but got `%s`", jsonObj.get("balances").toString())); + } + + // validate the optional field `balances` (array) + for (int i = 0; i < jsonArraybalances.size(); i++) { + Balance.validateJsonObject(jsonArraybalances.get(i).getAsJsonObject()); + }; + } + } + if (jsonObj.get("positions") != null && !jsonObj.get("positions").isJsonNull()) { + JsonArray jsonArraypositions = jsonObj.getAsJsonArray("positions"); + if (jsonArraypositions != null) { + // ensure the json data is an array + if (!jsonObj.get("positions").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `positions` to be an array in the JSON string but got `%s`", jsonObj.get("positions").toString())); + } + + // validate the optional field `positions` (array) + for (int i = 0; i < jsonArraypositions.size(); i++) { + Position.validateJsonObject(jsonArraypositions.get(i).getAsJsonObject()); + }; + } + } + if (jsonObj.get("target_positions") != null && !jsonObj.get("target_positions").isJsonNull()) { + JsonArray jsonArraytargetPositions = jsonObj.getAsJsonArray("target_positions"); + if (jsonArraytargetPositions != null) { + // ensure the json data is an array + if (!jsonObj.get("target_positions").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `target_positions` to be an array in the JSON string but got `%s`", jsonObj.get("target_positions").toString())); + } + + // validate the optional field `target_positions` (array) + for (int i = 0; i < jsonArraytargetPositions.size(); i++) { + TargetAsset.validateJsonObject(jsonArraytargetPositions.get(i).getAsJsonObject()); + }; + } + } + if (jsonObj.get("ideal_positions") != null && !jsonObj.get("ideal_positions").isJsonNull()) { + JsonArray jsonArrayidealPositions = jsonObj.getAsJsonArray("ideal_positions"); + if (jsonArrayidealPositions != null) { + // ensure the json data is an array + if (!jsonObj.get("ideal_positions").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `ideal_positions` to be an array in the JSON string but got `%s`", jsonObj.get("ideal_positions").toString())); + } + + // validate the optional field `ideal_positions` (array) + for (int i = 0; i < jsonArrayidealPositions.size(); i++) { + Position.validateJsonObject(jsonArrayidealPositions.get(i).getAsJsonObject()); + }; + } + } + if (jsonObj.get("excluded_positions") != null && !jsonObj.get("excluded_positions").isJsonNull()) { + JsonArray jsonArrayexcludedPositions = jsonObj.getAsJsonArray("excluded_positions"); + if (jsonArrayexcludedPositions != null) { + // ensure the json data is an array + if (!jsonObj.get("excluded_positions").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `excluded_positions` to be an array in the JSON string but got `%s`", jsonObj.get("excluded_positions").toString())); + } + + // validate the optional field `excluded_positions` (array) + for (int i = 0; i < jsonArrayexcludedPositions.size(); i++) { + ExcludedAsset.validateJsonObject(jsonArrayexcludedPositions.get(i).getAsJsonObject()); + }; + } + } + if (jsonObj.get("calculated_trades") != null && !jsonObj.get("calculated_trades").isJsonNull()) { + JsonArray jsonArraycalculatedTrades = jsonObj.getAsJsonArray("calculated_trades"); + if (jsonArraycalculatedTrades != null) { + // ensure the json data is an array + if (!jsonObj.get("calculated_trades").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `calculated_trades` to be an array in the JSON string but got `%s`", jsonObj.get("calculated_trades").toString())); + } + + // validate the optional field `calculated_trades` (array) + for (int i = 0; i < jsonArraycalculatedTrades.size(); i++) { + CalculatedTrade.validateJsonObject(jsonArraycalculatedTrades.get(i).getAsJsonObject()); + }; + } + } + if (jsonObj.get("brokerage_authorizations") != null && !jsonObj.get("brokerage_authorizations").isJsonNull()) { + JsonArray jsonArraybrokerageAuthorizations = jsonObj.getAsJsonArray("brokerage_authorizations"); + if (jsonArraybrokerageAuthorizations != null) { + // ensure the json data is an array + if (!jsonObj.get("brokerage_authorizations").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `brokerage_authorizations` to be an array in the JSON string but got `%s`", jsonObj.get("brokerage_authorizations").toString())); + } + + // validate the optional field `brokerage_authorizations` (array) + for (int i = 0; i < jsonArraybrokerageAuthorizations.size(); i++) { + BrokerageAuthorization.validateJsonObject(jsonArraybrokerageAuthorizations.get(i).getAsJsonObject()); + }; + } + } + // validate the optional field `settings` + if (jsonObj.get("settings") != null && !jsonObj.get("settings").isJsonNull()) { + PortfolioGroupSettings.validateJsonObject(jsonObj.getAsJsonObject("settings")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PortfolioGroupInfo.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PortfolioGroupInfo' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PortfolioGroupInfo.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PortfolioGroupInfo value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public PortfolioGroupInfo read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + PortfolioGroupInfo instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PortfolioGroupInfo given an JSON string + * + * @param jsonString JSON string + * @return An instance of PortfolioGroupInfo + * @throws IOException if the JSON string is invalid with respect to PortfolioGroupInfo + */ + public static PortfolioGroupInfo fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PortfolioGroupInfo.class); + } + + /** + * Convert an instance of PortfolioGroupInfo to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/PortfolioGroupPosition.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/PortfolioGroupPosition.java new file mode 100644 index 0000000000..e4c2787c1b --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/PortfolioGroupPosition.java @@ -0,0 +1,386 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.UniversalSymbol; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Details of a security held + */ +@ApiModel(description = "Details of a security held")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class PortfolioGroupPosition { + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + @SerializedName(SERIALIZED_NAME_SYMBOL) + private UniversalSymbol symbol; + + public static final String SERIALIZED_NAME_PRICE = "price"; + @SerializedName(SERIALIZED_NAME_PRICE) + private Double price; + + public static final String SERIALIZED_NAME_UNITS = "units"; + @SerializedName(SERIALIZED_NAME_UNITS) + private Integer units; + + public PortfolioGroupPosition() { + } + + public PortfolioGroupPosition symbol(UniversalSymbol symbol) { + + + + + this.symbol = symbol; + return this; + } + + /** + * Get symbol + * @return symbol + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public UniversalSymbol getSymbol() { + return symbol; + } + + + public void setSymbol(UniversalSymbol symbol) { + + + + this.symbol = symbol; + } + + + public PortfolioGroupPosition price(Double price) { + + + + + this.price = price; + return this; + } + + public PortfolioGroupPosition price(Integer price) { + + + + + this.price = price.doubleValue(); + return this; + } + + /** + * Last known market price for the symbol + * @return price + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "24.81", value = "Last known market price for the symbol") + + public Double getPrice() { + return price; + } + + + public void setPrice(Double price) { + + + + this.price = price; + } + + + public PortfolioGroupPosition units(Integer units) { + + + + + this.units = units; + return this; + } + + /** + * Get units + * @return units + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "15", value = "") + + public Integer getUnits() { + return units; + } + + + public void setUnits(Integer units) { + + + + this.units = units; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PortfolioGroupPosition instance itself + */ + public PortfolioGroupPosition putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PortfolioGroupPosition portfolioGroupPosition = (PortfolioGroupPosition) o; + return Objects.equals(this.symbol, portfolioGroupPosition.symbol) && + Objects.equals(this.price, portfolioGroupPosition.price) && + Objects.equals(this.units, portfolioGroupPosition.units)&& + Objects.equals(this.additionalProperties, portfolioGroupPosition.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(symbol, price, units, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PortfolioGroupPosition {\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append(" units: ").append(toIndentedString(units)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("symbol"); + openapiFields.add("price"); + openapiFields.add("units"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to PortfolioGroupPosition + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!PortfolioGroupPosition.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PortfolioGroupPosition is not found in the empty JSON string", PortfolioGroupPosition.openapiRequiredFields.toString())); + } + } + // validate the optional field `symbol` + if (jsonObj.get("symbol") != null && !jsonObj.get("symbol").isJsonNull()) { + UniversalSymbol.validateJsonObject(jsonObj.getAsJsonObject("symbol")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PortfolioGroupPosition.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PortfolioGroupPosition' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PortfolioGroupPosition.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PortfolioGroupPosition value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public PortfolioGroupPosition read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + PortfolioGroupPosition instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PortfolioGroupPosition given an JSON string + * + * @param jsonString JSON string + * @return An instance of PortfolioGroupPosition + * @throws IOException if the JSON string is invalid with respect to PortfolioGroupPosition + */ + public static PortfolioGroupPosition fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PortfolioGroupPosition.class); + } + + /** + * Convert an instance of PortfolioGroupPosition to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/PortfolioGroupSettings.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/PortfolioGroupSettings.java new file mode 100644 index 0000000000..59aa9b28a5 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/PortfolioGroupSettings.java @@ -0,0 +1,462 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.Currency; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * PortfolioGroupSettings + */@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class PortfolioGroupSettings { + public static final String SERIALIZED_NAME_BUY_ONLY = "buyOnly"; + @SerializedName(SERIALIZED_NAME_BUY_ONLY) + private Boolean buyOnly; + + public static final String SERIALIZED_NAME_CASH_OPTIMIZER = "cash_optimizer"; + @SerializedName(SERIALIZED_NAME_CASH_OPTIMIZER) + private Boolean cashOptimizer; + + public static final String SERIALIZED_NAME_NOTIFY_FREQUENCY = "notifyFrequency"; + @SerializedName(SERIALIZED_NAME_NOTIFY_FREQUENCY) + private String notifyFrequency; + + public static final String SERIALIZED_NAME_DRIFT_THRESHOLD = "driftThreshold"; + @SerializedName(SERIALIZED_NAME_DRIFT_THRESHOLD) + private Double driftThreshold; + + public static final String SERIALIZED_NAME_PREFERRED_CURRENCY = "preferred_currency"; + @SerializedName(SERIALIZED_NAME_PREFERRED_CURRENCY) + private Currency preferredCurrency; + + public PortfolioGroupSettings() { + } + + public PortfolioGroupSettings buyOnly(Boolean buyOnly) { + + + + + this.buyOnly = buyOnly; + return this; + } + + /** + * Get buyOnly + * @return buyOnly + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "true", value = "") + + public Boolean getBuyOnly() { + return buyOnly; + } + + + public void setBuyOnly(Boolean buyOnly) { + + + + this.buyOnly = buyOnly; + } + + + public PortfolioGroupSettings cashOptimizer(Boolean cashOptimizer) { + + + + + this.cashOptimizer = cashOptimizer; + return this; + } + + /** + * Get cashOptimizer + * @return cashOptimizer + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "true", value = "") + + public Boolean getCashOptimizer() { + return cashOptimizer; + } + + + public void setCashOptimizer(Boolean cashOptimizer) { + + + + this.cashOptimizer = cashOptimizer; + } + + + public PortfolioGroupSettings notifyFrequency(String notifyFrequency) { + + + + + this.notifyFrequency = notifyFrequency; + return this; + } + + /** + * Get notifyFrequency + * @return notifyFrequency + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "7 00:00:00", value = "") + + public String getNotifyFrequency() { + return notifyFrequency; + } + + + public void setNotifyFrequency(String notifyFrequency) { + + + + this.notifyFrequency = notifyFrequency; + } + + + public PortfolioGroupSettings driftThreshold(Double driftThreshold) { + if (driftThreshold != null && driftThreshold < 0) { + throw new IllegalArgumentException("Invalid value for driftThreshold. Must be greater than or equal to 0."); + } + if (driftThreshold != null && driftThreshold > 100) { + throw new IllegalArgumentException("Invalid value for driftThreshold. Must be less than or equal to 100."); + } + + + this.driftThreshold = driftThreshold; + return this; + } + + public PortfolioGroupSettings driftThreshold(Integer driftThreshold) { + if (driftThreshold != null && driftThreshold < 0) { + throw new IllegalArgumentException("Invalid value for driftThreshold. Must be greater than or equal to 0."); + } + if (driftThreshold != null && driftThreshold > 100) { + throw new IllegalArgumentException("Invalid value for driftThreshold. Must be less than or equal to 100."); + } + + + this.driftThreshold = driftThreshold.doubleValue(); + return this; + } + + /** + * Get driftThreshold + * minimum: 0 + * maximum: 100 + * @return driftThreshold + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "90", value = "") + + public Double getDriftThreshold() { + return driftThreshold; + } + + + public void setDriftThreshold(Double driftThreshold) { + if (driftThreshold != null && driftThreshold < 0) { + throw new IllegalArgumentException("Invalid value for driftThreshold. Must be greater than or equal to 0."); + } + if (driftThreshold != null && driftThreshold > 100) { + throw new IllegalArgumentException("Invalid value for driftThreshold. Must be less than or equal to 100."); + } + + this.driftThreshold = driftThreshold; + } + + + public PortfolioGroupSettings preferredCurrency(Currency preferredCurrency) { + + + + + this.preferredCurrency = preferredCurrency; + return this; + } + + /** + * Get preferredCurrency + * @return preferredCurrency + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Currency getPreferredCurrency() { + return preferredCurrency; + } + + + public void setPreferredCurrency(Currency preferredCurrency) { + + + + this.preferredCurrency = preferredCurrency; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PortfolioGroupSettings instance itself + */ + public PortfolioGroupSettings putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PortfolioGroupSettings portfolioGroupSettings = (PortfolioGroupSettings) o; + return Objects.equals(this.buyOnly, portfolioGroupSettings.buyOnly) && + Objects.equals(this.cashOptimizer, portfolioGroupSettings.cashOptimizer) && + Objects.equals(this.notifyFrequency, portfolioGroupSettings.notifyFrequency) && + Objects.equals(this.driftThreshold, portfolioGroupSettings.driftThreshold) && + Objects.equals(this.preferredCurrency, portfolioGroupSettings.preferredCurrency)&& + Objects.equals(this.additionalProperties, portfolioGroupSettings.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(buyOnly, cashOptimizer, notifyFrequency, driftThreshold, preferredCurrency, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PortfolioGroupSettings {\n"); + sb.append(" buyOnly: ").append(toIndentedString(buyOnly)).append("\n"); + sb.append(" cashOptimizer: ").append(toIndentedString(cashOptimizer)).append("\n"); + sb.append(" notifyFrequency: ").append(toIndentedString(notifyFrequency)).append("\n"); + sb.append(" driftThreshold: ").append(toIndentedString(driftThreshold)).append("\n"); + sb.append(" preferredCurrency: ").append(toIndentedString(preferredCurrency)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("buyOnly"); + openapiFields.add("cash_optimizer"); + openapiFields.add("notifyFrequency"); + openapiFields.add("driftThreshold"); + openapiFields.add("preferred_currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to PortfolioGroupSettings + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!PortfolioGroupSettings.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PortfolioGroupSettings is not found in the empty JSON string", PortfolioGroupSettings.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("notifyFrequency") != null && !jsonObj.get("notifyFrequency").isJsonNull()) && !jsonObj.get("notifyFrequency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `notifyFrequency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("notifyFrequency").toString())); + } + // validate the optional field `preferred_currency` + if (jsonObj.get("preferred_currency") != null && !jsonObj.get("preferred_currency").isJsonNull()) { + Currency.validateJsonObject(jsonObj.getAsJsonObject("preferred_currency")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PortfolioGroupSettings.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PortfolioGroupSettings' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PortfolioGroupSettings.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PortfolioGroupSettings value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public PortfolioGroupSettings read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + PortfolioGroupSettings instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PortfolioGroupSettings given an JSON string + * + * @param jsonString JSON string + * @return An instance of PortfolioGroupSettings + * @throws IOException if the JSON string is invalid with respect to PortfolioGroupSettings + */ + public static PortfolioGroupSettings fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PortfolioGroupSettings.class); + } + + /** + * Convert an instance of PortfolioGroupSettings to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/Position.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/Position.java new file mode 100644 index 0000000000..04a3ec331d --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/Position.java @@ -0,0 +1,532 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.PositionSymbol; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Describes a single stock/ETF/crypto/mutual fund position in an account. + */ +@ApiModel(description = "Describes a single stock/ETF/crypto/mutual fund position in an account.")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class Position { + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + @SerializedName(SERIALIZED_NAME_SYMBOL) + private PositionSymbol symbol; + + public static final String SERIALIZED_NAME_UNITS = "units"; + @SerializedName(SERIALIZED_NAME_UNITS) + private Double units; + + public static final String SERIALIZED_NAME_PRICE = "price"; + @SerializedName(SERIALIZED_NAME_PRICE) + private Double price; + + public static final String SERIALIZED_NAME_OPEN_PNL = "open_pnl"; + @SerializedName(SERIALIZED_NAME_OPEN_PNL) + private Double openPnl; + + public static final String SERIALIZED_NAME_FRACTIONAL_UNITS = "fractional_units"; + @SerializedName(SERIALIZED_NAME_FRACTIONAL_UNITS) + private Double fractionalUnits; + + public static final String SERIALIZED_NAME_AVERAGE_PURCHASE_PRICE = "average_purchase_price"; + @SerializedName(SERIALIZED_NAME_AVERAGE_PURCHASE_PRICE) + private Double averagePurchasePrice; + + public Position() { + } + + public Position symbol(PositionSymbol symbol) { + + + + + this.symbol = symbol; + return this; + } + + /** + * Get symbol + * @return symbol + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public PositionSymbol getSymbol() { + return symbol; + } + + + public void setSymbol(PositionSymbol symbol) { + + + + this.symbol = symbol; + } + + + public Position units(Double units) { + + + + + this.units = units; + return this; + } + + public Position units(Integer units) { + + + + + this.units = units.doubleValue(); + return this; + } + + /** + * The number of shares of the position. This can be fractional or integer units. + * @return units + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "40", value = "The number of shares of the position. This can be fractional or integer units.") + + public Double getUnits() { + return units; + } + + + public void setUnits(Double units) { + + + + this.units = units; + } + + + public Position price(Double price) { + + + + + this.price = price; + return this; + } + + public Position price(Integer price) { + + + + + this.price = price.doubleValue(); + return this; + } + + /** + * Last known market price for the symbol. The freshness of this price depends on the brokerage. Some brokerages provide real-time prices, while others provide delayed prices. It is recommended that you rely on your own third-party market data provider for most up to date prices. + * @return price + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "113.15", value = "Last known market price for the symbol. The freshness of this price depends on the brokerage. Some brokerages provide real-time prices, while others provide delayed prices. It is recommended that you rely on your own third-party market data provider for most up to date prices.") + + public Double getPrice() { + return price; + } + + + public void setPrice(Double price) { + + + + this.price = price; + } + + + public Position openPnl(Double openPnl) { + + + + + this.openPnl = openPnl; + return this; + } + + public Position openPnl(Integer openPnl) { + + + + + this.openPnl = openPnl.doubleValue(); + return this; + } + + /** + * The profit or loss on the position since it was opened. This is calculated as the difference between the current market value of the position and the total cost of the position. It is recommended to calculate this value using the average purchase price and the current market price yourself, instead of relying on this field. + * @return openPnl + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "0.44", value = "The profit or loss on the position since it was opened. This is calculated as the difference between the current market value of the position and the total cost of the position. It is recommended to calculate this value using the average purchase price and the current market price yourself, instead of relying on this field.") + + public Double getOpenPnl() { + return openPnl; + } + + + public void setOpenPnl(Double openPnl) { + + + + this.openPnl = openPnl; + } + + + public Position fractionalUnits(Double fractionalUnits) { + + + + + this.fractionalUnits = fractionalUnits; + return this; + } + + public Position fractionalUnits(Integer fractionalUnits) { + + + + + this.fractionalUnits = fractionalUnits.doubleValue(); + return this; + } + + /** + * Deprecated, use the `units` field for both fractional and integer units going forward + * @return fractionalUnits + * @deprecated + **/ + @Deprecated + @javax.annotation.Nullable + @ApiModelProperty(example = "1.44", value = "Deprecated, use the `units` field for both fractional and integer units going forward") + + public Double getFractionalUnits() { + return fractionalUnits; + } + + + public void setFractionalUnits(Double fractionalUnits) { + + + + this.fractionalUnits = fractionalUnits; + } + + + public Position averagePurchasePrice(Double averagePurchasePrice) { + + + + + this.averagePurchasePrice = averagePurchasePrice; + return this; + } + + public Position averagePurchasePrice(Integer averagePurchasePrice) { + + + + + this.averagePurchasePrice = averagePurchasePrice.doubleValue(); + return this; + } + + /** + * Cost basis _per share_ of this position. + * @return averagePurchasePrice + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "108.3353", value = "Cost basis _per share_ of this position.") + + public Double getAveragePurchasePrice() { + return averagePurchasePrice; + } + + + public void setAveragePurchasePrice(Double averagePurchasePrice) { + + + + this.averagePurchasePrice = averagePurchasePrice; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Position instance itself + */ + public Position putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Position position = (Position) o; + return Objects.equals(this.symbol, position.symbol) && + Objects.equals(this.units, position.units) && + Objects.equals(this.price, position.price) && + Objects.equals(this.openPnl, position.openPnl) && + Objects.equals(this.fractionalUnits, position.fractionalUnits) && + Objects.equals(this.averagePurchasePrice, position.averagePurchasePrice)&& + Objects.equals(this.additionalProperties, position.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(symbol, units, price, openPnl, fractionalUnits, averagePurchasePrice, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Position {\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" units: ").append(toIndentedString(units)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append(" openPnl: ").append(toIndentedString(openPnl)).append("\n"); + sb.append(" fractionalUnits: ").append(toIndentedString(fractionalUnits)).append("\n"); + sb.append(" averagePurchasePrice: ").append(toIndentedString(averagePurchasePrice)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("symbol"); + openapiFields.add("units"); + openapiFields.add("price"); + openapiFields.add("open_pnl"); + openapiFields.add("fractional_units"); + openapiFields.add("average_purchase_price"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to Position + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!Position.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Position is not found in the empty JSON string", Position.openapiRequiredFields.toString())); + } + } + // validate the optional field `symbol` + if (jsonObj.get("symbol") != null && !jsonObj.get("symbol").isJsonNull()) { + PositionSymbol.validateJsonObject(jsonObj.getAsJsonObject("symbol")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Position.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Position' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Position.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Position value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Position read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + Position instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Position given an JSON string + * + * @param jsonString JSON string + * @return An instance of Position + * @throws IOException if the JSON string is invalid with respect to Position + */ + public static Position fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Position.class); + } + + /** + * Convert an instance of Position to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/PositionSymbol.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/PositionSymbol.java new file mode 100644 index 0000000000..747444f34b --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/PositionSymbol.java @@ -0,0 +1,495 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.UniversalSymbol; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Symbol returned in position object + */ +@ApiModel(description = "Symbol returned in position object")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class PositionSymbol { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private UUID id; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + @SerializedName(SERIALIZED_NAME_SYMBOL) + private UniversalSymbol symbol; + + public static final String SERIALIZED_NAME_LOCAL_ID = "local_id"; + @SerializedName(SERIALIZED_NAME_LOCAL_ID) + private String localId; + + public static final String SERIALIZED_NAME_IS_QUOTABLE = "is_quotable"; + @SerializedName(SERIALIZED_NAME_IS_QUOTABLE) + private Boolean isQuotable; + + public static final String SERIALIZED_NAME_IS_TRADABLE = "is_tradable"; + @SerializedName(SERIALIZED_NAME_IS_TRADABLE) + private Boolean isTradable; + + public PositionSymbol() { + } + + public PositionSymbol id(UUID id) { + + + + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getId() { + return id; + } + + + public void setId(UUID id) { + + + + this.id = id; + } + + + public PositionSymbol description(String description) { + + + + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "VANGUARD CDN AGGREGATE BOND INDEX ETF", value = "") + + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + + + + this.description = description; + } + + + public PositionSymbol symbol(UniversalSymbol symbol) { + + + + + this.symbol = symbol; + return this; + } + + /** + * Get symbol + * @return symbol + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public UniversalSymbol getSymbol() { + return symbol; + } + + + public void setSymbol(UniversalSymbol symbol) { + + + + this.symbol = symbol; + } + + + public PositionSymbol localId(String localId) { + + + + + this.localId = localId; + return this; + } + + /** + * Get localId + * @return localId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "3291231", value = "") + + public String getLocalId() { + return localId; + } + + + public void setLocalId(String localId) { + + + + this.localId = localId; + } + + + public PositionSymbol isQuotable(Boolean isQuotable) { + + + + + this.isQuotable = isQuotable; + return this; + } + + /** + * Get isQuotable + * @return isQuotable + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "true", value = "") + + public Boolean getIsQuotable() { + return isQuotable; + } + + + public void setIsQuotable(Boolean isQuotable) { + + + + this.isQuotable = isQuotable; + } + + + public PositionSymbol isTradable(Boolean isTradable) { + + + + + this.isTradable = isTradable; + return this; + } + + /** + * Get isTradable + * @return isTradable + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "true", value = "") + + public Boolean getIsTradable() { + return isTradable; + } + + + public void setIsTradable(Boolean isTradable) { + + + + this.isTradable = isTradable; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PositionSymbol instance itself + */ + public PositionSymbol putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PositionSymbol positionSymbol = (PositionSymbol) o; + return Objects.equals(this.id, positionSymbol.id) && + Objects.equals(this.description, positionSymbol.description) && + Objects.equals(this.symbol, positionSymbol.symbol) && + Objects.equals(this.localId, positionSymbol.localId) && + Objects.equals(this.isQuotable, positionSymbol.isQuotable) && + Objects.equals(this.isTradable, positionSymbol.isTradable)&& + Objects.equals(this.additionalProperties, positionSymbol.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, description, symbol, localId, isQuotable, isTradable, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PositionSymbol {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" localId: ").append(toIndentedString(localId)).append("\n"); + sb.append(" isQuotable: ").append(toIndentedString(isQuotable)).append("\n"); + sb.append(" isTradable: ").append(toIndentedString(isTradable)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("description"); + openapiFields.add("symbol"); + openapiFields.add("local_id"); + openapiFields.add("is_quotable"); + openapiFields.add("is_tradable"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to PositionSymbol + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!PositionSymbol.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PositionSymbol is not found in the empty JSON string", PositionSymbol.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + // validate the optional field `symbol` + if (jsonObj.get("symbol") != null && !jsonObj.get("symbol").isJsonNull()) { + UniversalSymbol.validateJsonObject(jsonObj.getAsJsonObject("symbol")); + } + if (!jsonObj.get("local_id").isJsonNull() && (jsonObj.get("local_id") != null && !jsonObj.get("local_id").isJsonNull()) && !jsonObj.get("local_id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `local_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("local_id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PositionSymbol.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PositionSymbol' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PositionSymbol.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PositionSymbol value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public PositionSymbol read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + PositionSymbol instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PositionSymbol given an JSON string + * + * @param jsonString JSON string + * @return An instance of PositionSymbol + * @throws IOException if the JSON string is invalid with respect to PositionSymbol + */ + public static PositionSymbol fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PositionSymbol.class); + } + + /** + * Convert an instance of PositionSymbol to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/RedirectTokenandPin.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/RedirectTokenandPin.java new file mode 100644 index 0000000000..804ac27887 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/RedirectTokenandPin.java @@ -0,0 +1,330 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Response when register user is successful + */ +@ApiModel(description = "Response when register user is successful")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class RedirectTokenandPin { + public static final String SERIALIZED_NAME_TOKEN = "token"; + @SerializedName(SERIALIZED_NAME_TOKEN) + private String token; + + public static final String SERIALIZED_NAME_PIN = "pin"; + @SerializedName(SERIALIZED_NAME_PIN) + private String pin; + + public RedirectTokenandPin() { + } + + public RedirectTokenandPin token(String token) { + + + + + this.token = token; + return this; + } + + /** + * Get token + * @return token + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "myDAIBCP/EYqSmMByhMRB65aMa%2BdYhu2xRsGQe0sDd9SgZXMbdRh3eBaTh/bLViVGQoil6p9ytUUVhkqWalejOqCNVkXXTk/iNPTPaFCeh9%2B", value = "") + + public String getToken() { + return token; + } + + + public void setToken(String token) { + + + + this.token = token; + } + + + public RedirectTokenandPin pin(String pin) { + + + + + this.pin = pin; + return this; + } + + /** + * Get pin + * @return pin + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "usERdeFiP@1in9", value = "") + + public String getPin() { + return pin; + } + + + public void setPin(String pin) { + + + + this.pin = pin; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the RedirectTokenandPin instance itself + */ + public RedirectTokenandPin putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RedirectTokenandPin redirectTokenandPin = (RedirectTokenandPin) o; + return Objects.equals(this.token, redirectTokenandPin.token) && + Objects.equals(this.pin, redirectTokenandPin.pin)&& + Objects.equals(this.additionalProperties, redirectTokenandPin.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(token, pin, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RedirectTokenandPin {\n"); + sb.append(" token: ").append(toIndentedString(token)).append("\n"); + sb.append(" pin: ").append(toIndentedString(pin)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("token"); + openapiFields.add("pin"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to RedirectTokenandPin + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!RedirectTokenandPin.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RedirectTokenandPin is not found in the empty JSON string", RedirectTokenandPin.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("token") != null && !jsonObj.get("token").isJsonNull()) && !jsonObj.get("token").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `token` to be a primitive type in the JSON string but got `%s`", jsonObj.get("token").toString())); + } + if ((jsonObj.get("pin") != null && !jsonObj.get("pin").isJsonNull()) && !jsonObj.get("pin").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `pin` to be a primitive type in the JSON string but got `%s`", jsonObj.get("pin").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RedirectTokenandPin.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RedirectTokenandPin' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RedirectTokenandPin.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RedirectTokenandPin value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public RedirectTokenandPin read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + RedirectTokenandPin instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RedirectTokenandPin given an JSON string + * + * @param jsonString JSON string + * @return An instance of RedirectTokenandPin + * @throws IOException if the JSON string is invalid with respect to RedirectTokenandPin + */ + public static RedirectTokenandPin fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RedirectTokenandPin.class); + } + + /** + * Convert an instance of RedirectTokenandPin to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/SecurityType.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/SecurityType.java new file mode 100644 index 0000000000..db5de261e6 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/SecurityType.java @@ -0,0 +1,406 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Security Type + */ +@ApiModel(description = "Security Type")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class SecurityType { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private UUID id; + + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + private String code; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_IS_SUPPORTED = "is_supported"; + @SerializedName(SERIALIZED_NAME_IS_SUPPORTED) + private Boolean isSupported; + + public SecurityType() { + } + + public SecurityType id(UUID id) { + + + + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getId() { + return id; + } + + + public void setId(UUID id) { + + + + this.id = id; + } + + + public SecurityType code(String code) { + + + + + this.code = code; + return this; + } + + /** + * Get code + * @return code + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "cs", value = "") + + public String getCode() { + return code; + } + + + public void setCode(String code) { + + + + this.code = code; + } + + + public SecurityType description(String description) { + + + + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Common Stock", value = "") + + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + + + + this.description = description; + } + + + public SecurityType isSupported(Boolean isSupported) { + + + + + this.isSupported = isSupported; + return this; + } + + /** + * Get isSupported + * @return isSupported + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "true", value = "") + + public Boolean getIsSupported() { + return isSupported; + } + + + public void setIsSupported(Boolean isSupported) { + + + + this.isSupported = isSupported; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SecurityType instance itself + */ + public SecurityType putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SecurityType securityType = (SecurityType) o; + return Objects.equals(this.id, securityType.id) && + Objects.equals(this.code, securityType.code) && + Objects.equals(this.description, securityType.description) && + Objects.equals(this.isSupported, securityType.isSupported)&& + Objects.equals(this.additionalProperties, securityType.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, code, description, isSupported, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SecurityType {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" isSupported: ").append(toIndentedString(isSupported)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("code"); + openapiFields.add("description"); + openapiFields.add("is_supported"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to SecurityType + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!SecurityType.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SecurityType is not found in the empty JSON string", SecurityType.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SecurityType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SecurityType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SecurityType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SecurityType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SecurityType read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + SecurityType instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SecurityType given an JSON string + * + * @param jsonString JSON string + * @return An instance of SecurityType + * @throws IOException if the JSON string is invalid with respect to SecurityType + */ + public static SecurityType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SecurityType.class); + } + + /** + * Convert an instance of SecurityType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/SessionEvent.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/SessionEvent.java new file mode 100644 index 0000000000..75f1fe6d30 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/SessionEvent.java @@ -0,0 +1,607 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * SessionEvent + */@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class SessionEvent { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private UUID id; + + /** + * Gets or Sets sessionEventType + */ + @JsonAdapter(SessionEventTypeEnum.Adapter.class) + public enum SessionEventTypeEnum { + OAUTH_REDIRECT("OAUTH_REDIRECT"), + + DISCLAIMER_ACCEPTED("DISCLAIMER_ACCEPTED"), + + BROKERAGE_CONNECTION_INITIATED("BROKERAGE_CONNECTION_INITIATED"), + + BROKERAGE_RECONNECT_INITIATED("BROKERAGE_RECONNECT_INITIATED"), + + BROKERAGE_AUTHENTICATION("BROKERAGE_AUTHENTICATION"), + + OAUTH_BROKERAGE_AUTHENTICATION("OAUTH_BROKERAGE_AUTHENTICATION"), + + MFA_REQUESTED("MFA_REQUESTED"), + + MFA_SUBMITTED("MFA_SUBMITTED"), + + MFA_CHOICE_REQUESTED("MFA_CHOICE_REQUESTED"), + + MFA_CHOICE_SUBMITTED("MFA_CHOICE_SUBMITTED"), + + CONNECTION_SUCCESSFUL("CONNECTION_SUCCESSFUL"), + + CONNECTION_FAILED("CONNECTION_FAILED"), + + PARTNER_REDIRECT("PARTNER_REDIRECT"), + + CONNECTION_ABORTED("CONNECTION_ABORTED"), + + SESSION_STARTED("SESSION_STARTED"); + + private String value; + + SessionEventTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SessionEventTypeEnum fromValue(String value) { + for (SessionEventTypeEnum b : SessionEventTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SessionEventTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SessionEventTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SessionEventTypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_SESSION_EVENT_TYPE = "session_event_type"; + @SerializedName(SERIALIZED_NAME_SESSION_EVENT_TYPE) + private SessionEventTypeEnum sessionEventType; + + public static final String SERIALIZED_NAME_SESSION_ID = "session_id"; + @SerializedName(SERIALIZED_NAME_SESSION_ID) + private UUID sessionId; + + public static final String SERIALIZED_NAME_USER_ID = "user_id"; + @SerializedName(SERIALIZED_NAME_USER_ID) + private String userId; + + public static final String SERIALIZED_NAME_CREATED_DATE = "created_date"; + @SerializedName(SERIALIZED_NAME_CREATED_DATE) + private String createdDate; + + public static final String SERIALIZED_NAME_BROKERAGE_STATUS_CODE = "brokerage_status_code"; + @SerializedName(SERIALIZED_NAME_BROKERAGE_STATUS_CODE) + private Integer brokerageStatusCode; + + public static final String SERIALIZED_NAME_BROKERAGE_AUTHORIZATION_ID = "brokerage_authorization_id"; + @SerializedName(SERIALIZED_NAME_BROKERAGE_AUTHORIZATION_ID) + private UUID brokerageAuthorizationId; + + public SessionEvent() { + } + + public SessionEvent id(UUID id) { + + + + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getId() { + return id; + } + + + public void setId(UUID id) { + + + + this.id = id; + } + + + public SessionEvent sessionEventType(SessionEventTypeEnum sessionEventType) { + + + + + this.sessionEventType = sessionEventType; + return this; + } + + /** + * Get sessionEventType + * @return sessionEventType + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public SessionEventTypeEnum getSessionEventType() { + return sessionEventType; + } + + + public void setSessionEventType(SessionEventTypeEnum sessionEventType) { + + + + this.sessionEventType = sessionEventType; + } + + + public SessionEvent sessionId(UUID sessionId) { + + + + + this.sessionId = sessionId; + return this; + } + + /** + * Get sessionId + * @return sessionId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getSessionId() { + return sessionId; + } + + + public void setSessionId(UUID sessionId) { + + + + this.sessionId = sessionId; + } + + + public SessionEvent userId(String userId) { + + + + + this.userId = userId; + return this; + } + + /** + * SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable. + * @return userId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "snaptrade-user-123", value = "SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.") + + public String getUserId() { + return userId; + } + + + public void setUserId(String userId) { + + + + this.userId = userId; + } + + + public SessionEvent createdDate(String createdDate) { + + + + + this.createdDate = createdDate; + return this; + } + + /** + * Time + * @return createdDate + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2022-01-21T20:11:19.217Z", value = "Time") + + public String getCreatedDate() { + return createdDate; + } + + + public void setCreatedDate(String createdDate) { + + + + this.createdDate = createdDate; + } + + + public SessionEvent brokerageStatusCode(Integer brokerageStatusCode) { + + + + + this.brokerageStatusCode = brokerageStatusCode; + return this; + } + + /** + * Get brokerageStatusCode + * @return brokerageStatusCode + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "400", value = "") + + public Integer getBrokerageStatusCode() { + return brokerageStatusCode; + } + + + public void setBrokerageStatusCode(Integer brokerageStatusCode) { + + + + this.brokerageStatusCode = brokerageStatusCode; + } + + + public SessionEvent brokerageAuthorizationId(UUID brokerageAuthorizationId) { + + + + + this.brokerageAuthorizationId = brokerageAuthorizationId; + return this; + } + + /** + * Get brokerageAuthorizationId + * @return brokerageAuthorizationId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getBrokerageAuthorizationId() { + return brokerageAuthorizationId; + } + + + public void setBrokerageAuthorizationId(UUID brokerageAuthorizationId) { + + + + this.brokerageAuthorizationId = brokerageAuthorizationId; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SessionEvent instance itself + */ + public SessionEvent putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SessionEvent sessionEvent = (SessionEvent) o; + return Objects.equals(this.id, sessionEvent.id) && + Objects.equals(this.sessionEventType, sessionEvent.sessionEventType) && + Objects.equals(this.sessionId, sessionEvent.sessionId) && + Objects.equals(this.userId, sessionEvent.userId) && + Objects.equals(this.createdDate, sessionEvent.createdDate) && + Objects.equals(this.brokerageStatusCode, sessionEvent.brokerageStatusCode) && + Objects.equals(this.brokerageAuthorizationId, sessionEvent.brokerageAuthorizationId)&& + Objects.equals(this.additionalProperties, sessionEvent.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, sessionEventType, sessionId, userId, createdDate, brokerageStatusCode, brokerageAuthorizationId, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SessionEvent {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" sessionEventType: ").append(toIndentedString(sessionEventType)).append("\n"); + sb.append(" sessionId: ").append(toIndentedString(sessionId)).append("\n"); + sb.append(" userId: ").append(toIndentedString(userId)).append("\n"); + sb.append(" createdDate: ").append(toIndentedString(createdDate)).append("\n"); + sb.append(" brokerageStatusCode: ").append(toIndentedString(brokerageStatusCode)).append("\n"); + sb.append(" brokerageAuthorizationId: ").append(toIndentedString(brokerageAuthorizationId)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("session_event_type"); + openapiFields.add("session_id"); + openapiFields.add("user_id"); + openapiFields.add("created_date"); + openapiFields.add("brokerage_status_code"); + openapiFields.add("brokerage_authorization_id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to SessionEvent + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!SessionEvent.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SessionEvent is not found in the empty JSON string", SessionEvent.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("session_event_type") != null && !jsonObj.get("session_event_type").isJsonNull()) && !jsonObj.get("session_event_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `session_event_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("session_event_type").toString())); + } + if ((jsonObj.get("session_id") != null && !jsonObj.get("session_id").isJsonNull()) && !jsonObj.get("session_id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `session_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("session_id").toString())); + } + if ((jsonObj.get("user_id") != null && !jsonObj.get("user_id").isJsonNull()) && !jsonObj.get("user_id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `user_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("user_id").toString())); + } + if ((jsonObj.get("created_date") != null && !jsonObj.get("created_date").isJsonNull()) && !jsonObj.get("created_date").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `created_date` to be a primitive type in the JSON string but got `%s`", jsonObj.get("created_date").toString())); + } + if ((jsonObj.get("brokerage_authorization_id") != null && !jsonObj.get("brokerage_authorization_id").isJsonNull()) && !jsonObj.get("brokerage_authorization_id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `brokerage_authorization_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("brokerage_authorization_id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SessionEvent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SessionEvent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SessionEvent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SessionEvent value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SessionEvent read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + SessionEvent instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SessionEvent given an JSON string + * + * @param jsonString JSON string + * @return An instance of SessionEvent + * @throws IOException if the JSON string is invalid with respect to SessionEvent + */ + public static SessionEvent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SessionEvent.class); + } + + /** + * Convert an instance of SessionEvent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/SnapTradeAPIDisclaimerAcceptStatus.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/SnapTradeAPIDisclaimerAcceptStatus.java new file mode 100644 index 0000000000..9d78f3eeb5 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/SnapTradeAPIDisclaimerAcceptStatus.java @@ -0,0 +1,327 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Status of user acceptance of SnapTrade API disclaimer + */ +@ApiModel(description = "Status of user acceptance of SnapTrade API disclaimer")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class SnapTradeAPIDisclaimerAcceptStatus { + public static final String SERIALIZED_NAME_ACCEPTED = "accepted"; + @SerializedName(SERIALIZED_NAME_ACCEPTED) + private Boolean accepted; + + public static final String SERIALIZED_NAME_TIMESTAMP = "timestamp"; + @SerializedName(SERIALIZED_NAME_TIMESTAMP) + private String timestamp; + + public SnapTradeAPIDisclaimerAcceptStatus() { + } + + public SnapTradeAPIDisclaimerAcceptStatus accepted(Boolean accepted) { + + + + + this.accepted = accepted; + return this; + } + + /** + * Get accepted + * @return accepted + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Boolean getAccepted() { + return accepted; + } + + + public void setAccepted(Boolean accepted) { + + + + this.accepted = accepted; + } + + + public SnapTradeAPIDisclaimerAcceptStatus timestamp(String timestamp) { + + + + + this.timestamp = timestamp; + return this; + } + + /** + * Get timestamp + * @return timestamp + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2022-01-21T20:11:19.217Z", value = "") + + public String getTimestamp() { + return timestamp; + } + + + public void setTimestamp(String timestamp) { + + + + this.timestamp = timestamp; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SnapTradeAPIDisclaimerAcceptStatus instance itself + */ + public SnapTradeAPIDisclaimerAcceptStatus putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SnapTradeAPIDisclaimerAcceptStatus snapTradeAPIDisclaimerAcceptStatus = (SnapTradeAPIDisclaimerAcceptStatus) o; + return Objects.equals(this.accepted, snapTradeAPIDisclaimerAcceptStatus.accepted) && + Objects.equals(this.timestamp, snapTradeAPIDisclaimerAcceptStatus.timestamp)&& + Objects.equals(this.additionalProperties, snapTradeAPIDisclaimerAcceptStatus.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(accepted, timestamp, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SnapTradeAPIDisclaimerAcceptStatus {\n"); + sb.append(" accepted: ").append(toIndentedString(accepted)).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("accepted"); + openapiFields.add("timestamp"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to SnapTradeAPIDisclaimerAcceptStatus + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!SnapTradeAPIDisclaimerAcceptStatus.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SnapTradeAPIDisclaimerAcceptStatus is not found in the empty JSON string", SnapTradeAPIDisclaimerAcceptStatus.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("timestamp") != null && !jsonObj.get("timestamp").isJsonNull()) && !jsonObj.get("timestamp").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `timestamp` to be a primitive type in the JSON string but got `%s`", jsonObj.get("timestamp").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SnapTradeAPIDisclaimerAcceptStatus.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SnapTradeAPIDisclaimerAcceptStatus' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SnapTradeAPIDisclaimerAcceptStatus.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SnapTradeAPIDisclaimerAcceptStatus value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SnapTradeAPIDisclaimerAcceptStatus read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + SnapTradeAPIDisclaimerAcceptStatus instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SnapTradeAPIDisclaimerAcceptStatus given an JSON string + * + * @param jsonString JSON string + * @return An instance of SnapTradeAPIDisclaimerAcceptStatus + * @throws IOException if the JSON string is invalid with respect to SnapTradeAPIDisclaimerAcceptStatus + */ + public static SnapTradeAPIDisclaimerAcceptStatus fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SnapTradeAPIDisclaimerAcceptStatus.class); + } + + /** + * Convert an instance of SnapTradeAPIDisclaimerAcceptStatus to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/SnapTradeHoldingsAccount.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/SnapTradeHoldingsAccount.java new file mode 100644 index 0000000000..6b5079d11f --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/SnapTradeHoldingsAccount.java @@ -0,0 +1,588 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.AccountSyncStatus; +import com.konfigthis.client.model.BrokerageAuthorization; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * SnapTradeUser Investment Account + */ +@ApiModel(description = "SnapTradeUser Investment Account")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class SnapTradeHoldingsAccount { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private UUID id; + + public static final String SERIALIZED_NAME_BROKERAGE_AUTHORIZATION = "brokerage_authorization"; + @SerializedName(SERIALIZED_NAME_BROKERAGE_AUTHORIZATION) + private BrokerageAuthorization brokerageAuthorization; + + public static final String SERIALIZED_NAME_PORTFOLIO_GROUP = "portfolio_group"; + @SerializedName(SERIALIZED_NAME_PORTFOLIO_GROUP) + private UUID portfolioGroup; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_NUMBER = "number"; + @SerializedName(SERIALIZED_NAME_NUMBER) + private String number; + + public static final String SERIALIZED_NAME_INSTITUTION_NAME = "institution_name"; + @SerializedName(SERIALIZED_NAME_INSTITUTION_NAME) + private String institutionName; + + public static final String SERIALIZED_NAME_SYNC_STATUS = "sync_status"; + @SerializedName(SERIALIZED_NAME_SYNC_STATUS) + private AccountSyncStatus syncStatus; + + public static final String SERIALIZED_NAME_META = "meta"; + @SerializedName(SERIALIZED_NAME_META) + private Map meta = null; + + public SnapTradeHoldingsAccount() { + } + + public SnapTradeHoldingsAccount id(UUID id) { + + + + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getId() { + return id; + } + + + public void setId(UUID id) { + + + + this.id = id; + } + + + public SnapTradeHoldingsAccount brokerageAuthorization(BrokerageAuthorization brokerageAuthorization) { + + + + + this.brokerageAuthorization = brokerageAuthorization; + return this; + } + + /** + * Get brokerageAuthorization + * @return brokerageAuthorization + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public BrokerageAuthorization getBrokerageAuthorization() { + return brokerageAuthorization; + } + + + public void setBrokerageAuthorization(BrokerageAuthorization brokerageAuthorization) { + + + + this.brokerageAuthorization = brokerageAuthorization; + } + + + public SnapTradeHoldingsAccount portfolioGroup(UUID portfolioGroup) { + + + + + this.portfolioGroup = portfolioGroup; + return this; + } + + /** + * Get portfolioGroup + * @return portfolioGroup + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getPortfolioGroup() { + return portfolioGroup; + } + + + public void setPortfolioGroup(UUID portfolioGroup) { + + + + this.portfolioGroup = portfolioGroup; + } + + + public SnapTradeHoldingsAccount name(String name) { + + + + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Registered Retirement Savings Account", value = "") + + public String getName() { + return name; + } + + + public void setName(String name) { + + + + this.name = name; + } + + + public SnapTradeHoldingsAccount number(String number) { + + + + + this.number = number; + return this; + } + + /** + * Get number + * @return number + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Q6542138443", value = "") + + public String getNumber() { + return number; + } + + + public void setNumber(String number) { + + + + this.number = number; + } + + + public SnapTradeHoldingsAccount institutionName(String institutionName) { + + + + + this.institutionName = institutionName; + return this; + } + + /** + * Get institutionName + * @return institutionName + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Alpaca", value = "") + + public String getInstitutionName() { + return institutionName; + } + + + public void setInstitutionName(String institutionName) { + + + + this.institutionName = institutionName; + } + + + public SnapTradeHoldingsAccount syncStatus(AccountSyncStatus syncStatus) { + + + + + this.syncStatus = syncStatus; + return this; + } + + /** + * Get syncStatus + * @return syncStatus + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public AccountSyncStatus getSyncStatus() { + return syncStatus; + } + + + public void setSyncStatus(AccountSyncStatus syncStatus) { + + + + this.syncStatus = syncStatus; + } + + + public SnapTradeHoldingsAccount meta(Map meta) { + + + + + this.meta = meta; + return this; + } + + public SnapTradeHoldingsAccount putMetaItem(String key, Object metaItem) { + if (this.meta == null) { + this.meta = new HashMap<>(); + } + this.meta.put(key, metaItem); + return this; + } + + /** + * Get meta + * @return meta + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "{\"type\":\"Margin\",\"status\":\"ACTIVE\",\"institution_name\":\"Alpaca\"}", value = "") + + public Map getMeta() { + return meta; + } + + + public void setMeta(Map meta) { + + + + this.meta = meta; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SnapTradeHoldingsAccount instance itself + */ + public SnapTradeHoldingsAccount putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SnapTradeHoldingsAccount snapTradeHoldingsAccount = (SnapTradeHoldingsAccount) o; + return Objects.equals(this.id, snapTradeHoldingsAccount.id) && + Objects.equals(this.brokerageAuthorization, snapTradeHoldingsAccount.brokerageAuthorization) && + Objects.equals(this.portfolioGroup, snapTradeHoldingsAccount.portfolioGroup) && + Objects.equals(this.name, snapTradeHoldingsAccount.name) && + Objects.equals(this.number, snapTradeHoldingsAccount.number) && + Objects.equals(this.institutionName, snapTradeHoldingsAccount.institutionName) && + Objects.equals(this.syncStatus, snapTradeHoldingsAccount.syncStatus) && + Objects.equals(this.meta, snapTradeHoldingsAccount.meta)&& + Objects.equals(this.additionalProperties, snapTradeHoldingsAccount.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, brokerageAuthorization, portfolioGroup, name, number, institutionName, syncStatus, meta, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SnapTradeHoldingsAccount {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" brokerageAuthorization: ").append(toIndentedString(brokerageAuthorization)).append("\n"); + sb.append(" portfolioGroup: ").append(toIndentedString(portfolioGroup)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" number: ").append(toIndentedString(number)).append("\n"); + sb.append(" institutionName: ").append(toIndentedString(institutionName)).append("\n"); + sb.append(" syncStatus: ").append(toIndentedString(syncStatus)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("brokerage_authorization"); + openapiFields.add("portfolio_group"); + openapiFields.add("name"); + openapiFields.add("number"); + openapiFields.add("institution_name"); + openapiFields.add("sync_status"); + openapiFields.add("meta"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to SnapTradeHoldingsAccount + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!SnapTradeHoldingsAccount.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SnapTradeHoldingsAccount is not found in the empty JSON string", SnapTradeHoldingsAccount.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `brokerage_authorization` + if (jsonObj.get("brokerage_authorization") != null && !jsonObj.get("brokerage_authorization").isJsonNull()) { + BrokerageAuthorization.validateJsonObject(jsonObj.getAsJsonObject("brokerage_authorization")); + } + if ((jsonObj.get("portfolio_group") != null && !jsonObj.get("portfolio_group").isJsonNull()) && !jsonObj.get("portfolio_group").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `portfolio_group` to be a primitive type in the JSON string but got `%s`", jsonObj.get("portfolio_group").toString())); + } + if (!jsonObj.get("name").isJsonNull() && (jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("number") != null && !jsonObj.get("number").isJsonNull()) && !jsonObj.get("number").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `number` to be a primitive type in the JSON string but got `%s`", jsonObj.get("number").toString())); + } + if ((jsonObj.get("institution_name") != null && !jsonObj.get("institution_name").isJsonNull()) && !jsonObj.get("institution_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `institution_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("institution_name").toString())); + } + // validate the optional field `sync_status` + if (jsonObj.get("sync_status") != null && !jsonObj.get("sync_status").isJsonNull()) { + AccountSyncStatus.validateJsonObject(jsonObj.getAsJsonObject("sync_status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SnapTradeHoldingsAccount.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SnapTradeHoldingsAccount' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SnapTradeHoldingsAccount.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SnapTradeHoldingsAccount value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SnapTradeHoldingsAccount read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + SnapTradeHoldingsAccount instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SnapTradeHoldingsAccount given an JSON string + * + * @param jsonString JSON string + * @return An instance of SnapTradeHoldingsAccount + * @throws IOException if the JSON string is invalid with respect to SnapTradeHoldingsAccount + */ + public static SnapTradeHoldingsAccount fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SnapTradeHoldingsAccount.class); + } + + /** + * Convert an instance of SnapTradeHoldingsAccount to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/SnapTradeHoldingsAccountAccountId.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/SnapTradeHoldingsAccountAccountId.java new file mode 100644 index 0000000000..1bd922df1a --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/SnapTradeHoldingsAccountAccountId.java @@ -0,0 +1,690 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.AccountBalanceNullable; +import com.konfigthis.client.model.CashRestriction; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * A single brokerage account at a financial institution. + */ +@ApiModel(description = "A single brokerage account at a financial institution.")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class SnapTradeHoldingsAccountAccountId { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private UUID id; + + public static final String SERIALIZED_NAME_BROKERAGE_AUTHORIZATION = "brokerage_authorization"; + @SerializedName(SERIALIZED_NAME_BROKERAGE_AUTHORIZATION) + private UUID brokerageAuthorization; + + public static final String SERIALIZED_NAME_PORTFOLIO_GROUP = "portfolio_group"; + @SerializedName(SERIALIZED_NAME_PORTFOLIO_GROUP) + private UUID portfolioGroup; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_NUMBER = "number"; + @SerializedName(SERIALIZED_NAME_NUMBER) + private String number; + + public static final String SERIALIZED_NAME_INSTITUTION_NAME = "institution_name"; + @SerializedName(SERIALIZED_NAME_INSTITUTION_NAME) + private String institutionName; + + public static final String SERIALIZED_NAME_BALANCE = "balance"; + @SerializedName(SERIALIZED_NAME_BALANCE) + private AccountBalanceNullable balance; + + public static final String SERIALIZED_NAME_META = "meta"; + @SerializedName(SERIALIZED_NAME_META) + private Map meta = null; + + public static final String SERIALIZED_NAME_CASH_RESTRICTIONS = "cash_restrictions"; + @SerializedName(SERIALIZED_NAME_CASH_RESTRICTIONS) + private List cashRestrictions = null; + + public static final String SERIALIZED_NAME_CREATED_DATE = "created_date"; + @SerializedName(SERIALIZED_NAME_CREATED_DATE) + private OffsetDateTime createdDate; + + public SnapTradeHoldingsAccountAccountId() { + } + + public SnapTradeHoldingsAccountAccountId id(UUID id) { + + + + + this.id = id; + return this; + } + + /** + * Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade. + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "917c8734-8470-4a3e-a18f-57c3f2ee6631", value = "Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.") + + public UUID getId() { + return id; + } + + + public void setId(UUID id) { + + + + this.id = id; + } + + + public SnapTradeHoldingsAccountAccountId brokerageAuthorization(UUID brokerageAuthorization) { + + + + + this.brokerageAuthorization = brokerageAuthorization; + return this; + } + + /** + * Unique identifier for the connection (brokerage authorization). This is the UUID used to reference the connection in SnapTrade. + * @return brokerageAuthorization + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "87b24961-b51e-4db8-9226-f198f6518a89", value = "Unique identifier for the connection (brokerage authorization). This is the UUID used to reference the connection in SnapTrade.") + + public UUID getBrokerageAuthorization() { + return brokerageAuthorization; + } + + + public void setBrokerageAuthorization(UUID brokerageAuthorization) { + + + + this.brokerageAuthorization = brokerageAuthorization; + } + + + public SnapTradeHoldingsAccountAccountId portfolioGroup(UUID portfolioGroup) { + + + + + this.portfolioGroup = portfolioGroup; + return this; + } + + /** + * Portfolio Group ID. Portfolio Groups have been deprecated. Please contact support if you have a usecase for it. + * @return portfolioGroup + * @deprecated + **/ + @Deprecated + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "Portfolio Group ID. Portfolio Groups have been deprecated. Please contact support if you have a usecase for it.") + + public UUID getPortfolioGroup() { + return portfolioGroup; + } + + + public void setPortfolioGroup(UUID portfolioGroup) { + + + + this.portfolioGroup = portfolioGroup; + } + + + public SnapTradeHoldingsAccountAccountId name(String name) { + + + + + this.name = name; + return this; + } + + /** + * A display name for the account. Either assigned by the user or by the financial institution itself. For certain institutions, SnapTrade appends the institution name to the account name for clarity. + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Robinhood Individual", value = "A display name for the account. Either assigned by the user or by the financial institution itself. For certain institutions, SnapTrade appends the institution name to the account name for clarity.") + + public String getName() { + return name; + } + + + public void setName(String name) { + + + + this.name = name; + } + + + public SnapTradeHoldingsAccountAccountId number(String number) { + + + + + this.number = number; + return this; + } + + /** + * The account number assigned by the financial institution. + * @return number + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Q6542138443", value = "The account number assigned by the financial institution.") + + public String getNumber() { + return number; + } + + + public void setNumber(String number) { + + + + this.number = number; + } + + + public SnapTradeHoldingsAccountAccountId institutionName(String institutionName) { + + + + + this.institutionName = institutionName; + return this; + } + + /** + * The name of the financial institution that holds the account. + * @return institutionName + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Alpaca", value = "The name of the financial institution that holds the account.") + + public String getInstitutionName() { + return institutionName; + } + + + public void setInstitutionName(String institutionName) { + + + + this.institutionName = institutionName; + } + + + public SnapTradeHoldingsAccountAccountId balance(AccountBalanceNullable balance) { + + + + + this.balance = balance; + return this; + } + + /** + * Get balance + * @return balance + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public AccountBalanceNullable getBalance() { + return balance; + } + + + public void setBalance(AccountBalanceNullable balance) { + + + + this.balance = balance; + } + + + public SnapTradeHoldingsAccountAccountId meta(Map meta) { + + + + + this.meta = meta; + return this; + } + + public SnapTradeHoldingsAccountAccountId putMetaItem(String key, Object metaItem) { + if (this.meta == null) { + this.meta = new HashMap<>(); + } + this.meta.put(key, metaItem); + return this; + } + + /** + * Additional information about the account, such as account type, status, etc. This information is specific to the financial institution and there's no standard format for this data. Please use at your own risk. + * @return meta + * @deprecated + **/ + @Deprecated + @javax.annotation.Nullable + @ApiModelProperty(example = "{\"type\":\"Margin\",\"status\":\"ACTIVE\",\"institution_name\":\"Alpaca\"}", value = "Additional information about the account, such as account type, status, etc. This information is specific to the financial institution and there's no standard format for this data. Please use at your own risk.") + + public Map getMeta() { + return meta; + } + + + public void setMeta(Map meta) { + + + + this.meta = meta; + } + + + public SnapTradeHoldingsAccountAccountId cashRestrictions(List cashRestrictions) { + + + + + this.cashRestrictions = cashRestrictions; + return this; + } + + public SnapTradeHoldingsAccountAccountId addCashRestrictionsItem(CashRestriction cashRestrictionsItem) { + if (this.cashRestrictions == null) { + this.cashRestrictions = new ArrayList<>(); + } + this.cashRestrictions.add(cashRestrictionsItem); + return this; + } + + /** + * This field is deprecated. + * @return cashRestrictions + * @deprecated + **/ + @Deprecated + @javax.annotation.Nullable + @ApiModelProperty(value = "This field is deprecated.") + + public List getCashRestrictions() { + return cashRestrictions; + } + + + public void setCashRestrictions(List cashRestrictions) { + + + + this.cashRestrictions = cashRestrictions; + } + + + public SnapTradeHoldingsAccountAccountId createdDate(OffsetDateTime createdDate) { + + + + + this.createdDate = createdDate; + return this; + } + + /** + * Timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format indicating when the account was created in SnapTrade. This is _not_ the account opening date at the financial institution. + * @return createdDate + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2024-07-23T22:50:22.761Z", value = "Timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format indicating when the account was created in SnapTrade. This is _not_ the account opening date at the financial institution.") + + public OffsetDateTime getCreatedDate() { + return createdDate; + } + + + public void setCreatedDate(OffsetDateTime createdDate) { + + + + this.createdDate = createdDate; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SnapTradeHoldingsAccountAccountId instance itself + */ + public SnapTradeHoldingsAccountAccountId putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SnapTradeHoldingsAccountAccountId snapTradeHoldingsAccountAccountId = (SnapTradeHoldingsAccountAccountId) o; + return Objects.equals(this.id, snapTradeHoldingsAccountAccountId.id) && + Objects.equals(this.brokerageAuthorization, snapTradeHoldingsAccountAccountId.brokerageAuthorization) && + Objects.equals(this.portfolioGroup, snapTradeHoldingsAccountAccountId.portfolioGroup) && + Objects.equals(this.name, snapTradeHoldingsAccountAccountId.name) && + Objects.equals(this.number, snapTradeHoldingsAccountAccountId.number) && + Objects.equals(this.institutionName, snapTradeHoldingsAccountAccountId.institutionName) && + Objects.equals(this.balance, snapTradeHoldingsAccountAccountId.balance) && + Objects.equals(this.meta, snapTradeHoldingsAccountAccountId.meta) && + Objects.equals(this.cashRestrictions, snapTradeHoldingsAccountAccountId.cashRestrictions) && + Objects.equals(this.createdDate, snapTradeHoldingsAccountAccountId.createdDate)&& + Objects.equals(this.additionalProperties, snapTradeHoldingsAccountAccountId.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, brokerageAuthorization, portfolioGroup, name, number, institutionName, balance, meta, cashRestrictions, createdDate, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SnapTradeHoldingsAccountAccountId {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" brokerageAuthorization: ").append(toIndentedString(brokerageAuthorization)).append("\n"); + sb.append(" portfolioGroup: ").append(toIndentedString(portfolioGroup)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" number: ").append(toIndentedString(number)).append("\n"); + sb.append(" institutionName: ").append(toIndentedString(institutionName)).append("\n"); + sb.append(" balance: ").append(toIndentedString(balance)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).append("\n"); + sb.append(" cashRestrictions: ").append(toIndentedString(cashRestrictions)).append("\n"); + sb.append(" createdDate: ").append(toIndentedString(createdDate)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("brokerage_authorization"); + openapiFields.add("portfolio_group"); + openapiFields.add("name"); + openapiFields.add("number"); + openapiFields.add("institution_name"); + openapiFields.add("balance"); + openapiFields.add("meta"); + openapiFields.add("cash_restrictions"); + openapiFields.add("created_date"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to SnapTradeHoldingsAccountAccountId + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!SnapTradeHoldingsAccountAccountId.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SnapTradeHoldingsAccountAccountId is not found in the empty JSON string", SnapTradeHoldingsAccountAccountId.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("brokerage_authorization") != null && !jsonObj.get("brokerage_authorization").isJsonNull()) && !jsonObj.get("brokerage_authorization").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `brokerage_authorization` to be a primitive type in the JSON string but got `%s`", jsonObj.get("brokerage_authorization").toString())); + } + if ((jsonObj.get("portfolio_group") != null && !jsonObj.get("portfolio_group").isJsonNull()) && !jsonObj.get("portfolio_group").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `portfolio_group` to be a primitive type in the JSON string but got `%s`", jsonObj.get("portfolio_group").toString())); + } + if (!jsonObj.get("name").isJsonNull() && (jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("number") != null && !jsonObj.get("number").isJsonNull()) && !jsonObj.get("number").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `number` to be a primitive type in the JSON string but got `%s`", jsonObj.get("number").toString())); + } + if ((jsonObj.get("institution_name") != null && !jsonObj.get("institution_name").isJsonNull()) && !jsonObj.get("institution_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `institution_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("institution_name").toString())); + } + // validate the optional field `balance` + if (jsonObj.get("balance") != null && !jsonObj.get("balance").isJsonNull()) { + AccountBalanceNullable.validateJsonObject(jsonObj.getAsJsonObject("balance")); + } + if (jsonObj.get("cash_restrictions") != null && !jsonObj.get("cash_restrictions").isJsonNull()) { + JsonArray jsonArraycashRestrictions = jsonObj.getAsJsonArray("cash_restrictions"); + if (jsonArraycashRestrictions != null) { + // ensure the json data is an array + if (!jsonObj.get("cash_restrictions").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `cash_restrictions` to be an array in the JSON string but got `%s`", jsonObj.get("cash_restrictions").toString())); + } + + // validate the optional field `cash_restrictions` (array) + for (int i = 0; i < jsonArraycashRestrictions.size(); i++) { + CashRestriction.validateJsonObject(jsonArraycashRestrictions.get(i).getAsJsonObject()); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SnapTradeHoldingsAccountAccountId.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SnapTradeHoldingsAccountAccountId' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SnapTradeHoldingsAccountAccountId.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SnapTradeHoldingsAccountAccountId value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SnapTradeHoldingsAccountAccountId read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + SnapTradeHoldingsAccountAccountId instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SnapTradeHoldingsAccountAccountId given an JSON string + * + * @param jsonString JSON string + * @return An instance of SnapTradeHoldingsAccountAccountId + * @throws IOException if the JSON string is invalid with respect to SnapTradeHoldingsAccountAccountId + */ + public static SnapTradeHoldingsAccountAccountId fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SnapTradeHoldingsAccountAccountId.class); + } + + /** + * Convert an instance of SnapTradeHoldingsAccountAccountId to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/SnapTradeHoldingsTotalValue.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/SnapTradeHoldingsTotalValue.java new file mode 100644 index 0000000000..9018f05a0f --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/SnapTradeHoldingsTotalValue.java @@ -0,0 +1,348 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * The total market value of the account. Note that this field is calculated based on the sum of the values of account positions and cash balances known to SnapTrade. It may not be accurate if the brokerage account has holdings that SnapTrade is not aware of. For example, if the brokerage account holds assets that SnapTrade does not support, the total value may be underreported. To get the brokerage reported total market value of the account, refer to `account.balance.total`. + */ +@ApiModel(description = "The total market value of the account. Note that this field is calculated based on the sum of the values of account positions and cash balances known to SnapTrade. It may not be accurate if the brokerage account has holdings that SnapTrade is not aware of. For example, if the brokerage account holds assets that SnapTrade does not support, the total value may be underreported. To get the brokerage reported total market value of the account, refer to `account.balance.total`.")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class SnapTradeHoldingsTotalValue { + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + private Double value; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + private String currency; + + public SnapTradeHoldingsTotalValue() { + } + + public SnapTradeHoldingsTotalValue value(Double value) { + + + + + this.value = value; + return this; + } + + public SnapTradeHoldingsTotalValue value(Integer value) { + + + + + this.value = value.doubleValue(); + return this; + } + + /** + * Total value denominated in the currency of the `currency` field. + * @return value + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "32600.71", value = "Total value denominated in the currency of the `currency` field.") + + public Double getValue() { + return value; + } + + + public void setValue(Double value) { + + + + this.value = value; + } + + + public SnapTradeHoldingsTotalValue currency(String currency) { + + + + + this.currency = currency; + return this; + } + + /** + * The ISO-4217 currency code for the amount. + * @return currency + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "USD", value = "The ISO-4217 currency code for the amount.") + + public String getCurrency() { + return currency; + } + + + public void setCurrency(String currency) { + + + + this.currency = currency; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SnapTradeHoldingsTotalValue instance itself + */ + public SnapTradeHoldingsTotalValue putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SnapTradeHoldingsTotalValue snapTradeHoldingsTotalValue = (SnapTradeHoldingsTotalValue) o; + return Objects.equals(this.value, snapTradeHoldingsTotalValue.value) && + Objects.equals(this.currency, snapTradeHoldingsTotalValue.currency)&& + Objects.equals(this.additionalProperties, snapTradeHoldingsTotalValue.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(value, currency, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SnapTradeHoldingsTotalValue {\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("value"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to SnapTradeHoldingsTotalValue + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!SnapTradeHoldingsTotalValue.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SnapTradeHoldingsTotalValue is not found in the empty JSON string", SnapTradeHoldingsTotalValue.openapiRequiredFields.toString())); + } + } + if (!jsonObj.get("currency").isJsonNull() && (jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) && !jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SnapTradeHoldingsTotalValue.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SnapTradeHoldingsTotalValue' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SnapTradeHoldingsTotalValue.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SnapTradeHoldingsTotalValue value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SnapTradeHoldingsTotalValue read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + SnapTradeHoldingsTotalValue instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SnapTradeHoldingsTotalValue given an JSON string + * + * @param jsonString JSON string + * @return An instance of SnapTradeHoldingsTotalValue + * @throws IOException if the JSON string is invalid with respect to SnapTradeHoldingsTotalValue + */ + public static SnapTradeHoldingsTotalValue fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SnapTradeHoldingsTotalValue.class); + } + + /** + * Convert an instance of SnapTradeHoldingsTotalValue to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/SnapTradeLoginUserRequestBody.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/SnapTradeLoginUserRequestBody.java new file mode 100644 index 0000000000..62827cc780 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/SnapTradeLoginUserRequestBody.java @@ -0,0 +1,577 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Data to login a user via SnapTrade Partner + */ +@ApiModel(description = "Data to login a user via SnapTrade Partner")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class SnapTradeLoginUserRequestBody { + public static final String SERIALIZED_NAME_BROKER = "broker"; + @SerializedName(SERIALIZED_NAME_BROKER) + private String broker; + + public static final String SERIALIZED_NAME_IMMEDIATE_REDIRECT = "immediateRedirect"; + @SerializedName(SERIALIZED_NAME_IMMEDIATE_REDIRECT) + private Boolean immediateRedirect; + + public static final String SERIALIZED_NAME_CUSTOM_REDIRECT = "customRedirect"; + @SerializedName(SERIALIZED_NAME_CUSTOM_REDIRECT) + private String customRedirect; + + public static final String SERIALIZED_NAME_RECONNECT = "reconnect"; + @SerializedName(SERIALIZED_NAME_RECONNECT) + private String reconnect; + + /** + * Sets whether the connection should be read or trade + */ + @JsonAdapter(ConnectionTypeEnum.Adapter.class) + public enum ConnectionTypeEnum { + READ("read"), + + TRADE("trade"); + + private String value; + + ConnectionTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ConnectionTypeEnum fromValue(String value) { + for (ConnectionTypeEnum b : ConnectionTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ConnectionTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ConnectionTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ConnectionTypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_CONNECTION_TYPE = "connectionType"; + @SerializedName(SERIALIZED_NAME_CONNECTION_TYPE) + private ConnectionTypeEnum connectionType; + + /** + * Sets the version of the connection portal to render, with a default to 'v3' + */ + @JsonAdapter(ConnectionPortalVersionEnum.Adapter.class) + public enum ConnectionPortalVersionEnum { + V2("v2"), + + V3("v3"); + + private String value; + + ConnectionPortalVersionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ConnectionPortalVersionEnum fromValue(String value) { + for (ConnectionPortalVersionEnum b : ConnectionPortalVersionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ConnectionPortalVersionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ConnectionPortalVersionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ConnectionPortalVersionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_CONNECTION_PORTAL_VERSION = "connectionPortalVersion"; + @SerializedName(SERIALIZED_NAME_CONNECTION_PORTAL_VERSION) + private ConnectionPortalVersionEnum connectionPortalVersion; + + public SnapTradeLoginUserRequestBody() { + } + + public SnapTradeLoginUserRequestBody broker(String broker) { + + + + + this.broker = broker; + return this; + } + + /** + * Slug of the brokerage to connect the user to. See [this document](https://snaptrade.notion.site/SnapTrade-Brokerage-Integrations-f83946a714a84c3caf599f6a945f0ead) for a list of supported brokerages and their slugs. + * @return broker + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "ALPACA", value = "Slug of the brokerage to connect the user to. See [this document](https://snaptrade.notion.site/SnapTrade-Brokerage-Integrations-f83946a714a84c3caf599f6a945f0ead) for a list of supported brokerages and their slugs.") + + public String getBroker() { + return broker; + } + + + public void setBroker(String broker) { + + + + this.broker = broker; + } + + + public SnapTradeLoginUserRequestBody immediateRedirect(Boolean immediateRedirect) { + + + + + this.immediateRedirect = immediateRedirect; + return this; + } + + /** + * When set to True, user will be redirected back to the partner's site instead of the connection portal + * @return immediateRedirect + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "true", value = "When set to True, user will be redirected back to the partner's site instead of the connection portal") + + public Boolean getImmediateRedirect() { + return immediateRedirect; + } + + + public void setImmediateRedirect(Boolean immediateRedirect) { + + + + this.immediateRedirect = immediateRedirect; + } + + + public SnapTradeLoginUserRequestBody customRedirect(String customRedirect) { + + + + + this.customRedirect = customRedirect; + return this; + } + + /** + * URL to redirect the user to after the user connects their brokerage account + * @return customRedirect + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "https://snaptrade.com", value = "URL to redirect the user to after the user connects their brokerage account") + + public String getCustomRedirect() { + return customRedirect; + } + + + public void setCustomRedirect(String customRedirect) { + + + + this.customRedirect = customRedirect; + } + + + public SnapTradeLoginUserRequestBody reconnect(String reconnect) { + + + + + this.reconnect = reconnect; + return this; + } + + /** + * The UUID of the brokerage connection to be reconnected. This parameter should be left empty unless you are reconnecting a disabled connection. See ‘Reconnecting Accounts’ for more information. + * @return reconnect + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "8b5f262d-4bb9-365d-888a-202bd3b15fa1", value = "The UUID of the brokerage connection to be reconnected. This parameter should be left empty unless you are reconnecting a disabled connection. See ‘Reconnecting Accounts’ for more information.") + + public String getReconnect() { + return reconnect; + } + + + public void setReconnect(String reconnect) { + + + + this.reconnect = reconnect; + } + + + public SnapTradeLoginUserRequestBody connectionType(ConnectionTypeEnum connectionType) { + + + + + this.connectionType = connectionType; + return this; + } + + /** + * Sets whether the connection should be read or trade + * @return connectionType + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Sets whether the connection should be read or trade") + + public ConnectionTypeEnum getConnectionType() { + return connectionType; + } + + + public void setConnectionType(ConnectionTypeEnum connectionType) { + + + + this.connectionType = connectionType; + } + + + public SnapTradeLoginUserRequestBody connectionPortalVersion(ConnectionPortalVersionEnum connectionPortalVersion) { + + + + + this.connectionPortalVersion = connectionPortalVersion; + return this; + } + + /** + * Sets the version of the connection portal to render, with a default to 'v3' + * @return connectionPortalVersion + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Sets the version of the connection portal to render, with a default to 'v3'") + + public ConnectionPortalVersionEnum getConnectionPortalVersion() { + return connectionPortalVersion; + } + + + public void setConnectionPortalVersion(ConnectionPortalVersionEnum connectionPortalVersion) { + + + + this.connectionPortalVersion = connectionPortalVersion; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SnapTradeLoginUserRequestBody instance itself + */ + public SnapTradeLoginUserRequestBody putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SnapTradeLoginUserRequestBody snapTradeLoginUserRequestBody = (SnapTradeLoginUserRequestBody) o; + return Objects.equals(this.broker, snapTradeLoginUserRequestBody.broker) && + Objects.equals(this.immediateRedirect, snapTradeLoginUserRequestBody.immediateRedirect) && + Objects.equals(this.customRedirect, snapTradeLoginUserRequestBody.customRedirect) && + Objects.equals(this.reconnect, snapTradeLoginUserRequestBody.reconnect) && + Objects.equals(this.connectionType, snapTradeLoginUserRequestBody.connectionType) && + Objects.equals(this.connectionPortalVersion, snapTradeLoginUserRequestBody.connectionPortalVersion)&& + Objects.equals(this.additionalProperties, snapTradeLoginUserRequestBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(broker, immediateRedirect, customRedirect, reconnect, connectionType, connectionPortalVersion, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SnapTradeLoginUserRequestBody {\n"); + sb.append(" broker: ").append(toIndentedString(broker)).append("\n"); + sb.append(" immediateRedirect: ").append(toIndentedString(immediateRedirect)).append("\n"); + sb.append(" customRedirect: ").append(toIndentedString(customRedirect)).append("\n"); + sb.append(" reconnect: ").append(toIndentedString(reconnect)).append("\n"); + sb.append(" connectionType: ").append(toIndentedString(connectionType)).append("\n"); + sb.append(" connectionPortalVersion: ").append(toIndentedString(connectionPortalVersion)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("broker"); + openapiFields.add("immediateRedirect"); + openapiFields.add("customRedirect"); + openapiFields.add("reconnect"); + openapiFields.add("connectionType"); + openapiFields.add("connectionPortalVersion"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to SnapTradeLoginUserRequestBody + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!SnapTradeLoginUserRequestBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SnapTradeLoginUserRequestBody is not found in the empty JSON string", SnapTradeLoginUserRequestBody.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("broker") != null && !jsonObj.get("broker").isJsonNull()) && !jsonObj.get("broker").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `broker` to be a primitive type in the JSON string but got `%s`", jsonObj.get("broker").toString())); + } + if ((jsonObj.get("customRedirect") != null && !jsonObj.get("customRedirect").isJsonNull()) && !jsonObj.get("customRedirect").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `customRedirect` to be a primitive type in the JSON string but got `%s`", jsonObj.get("customRedirect").toString())); + } + if ((jsonObj.get("reconnect") != null && !jsonObj.get("reconnect").isJsonNull()) && !jsonObj.get("reconnect").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `reconnect` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reconnect").toString())); + } + if ((jsonObj.get("connectionType") != null && !jsonObj.get("connectionType").isJsonNull()) && !jsonObj.get("connectionType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `connectionType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("connectionType").toString())); + } + if ((jsonObj.get("connectionPortalVersion") != null && !jsonObj.get("connectionPortalVersion").isJsonNull()) && !jsonObj.get("connectionPortalVersion").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `connectionPortalVersion` to be a primitive type in the JSON string but got `%s`", jsonObj.get("connectionPortalVersion").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SnapTradeLoginUserRequestBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SnapTradeLoginUserRequestBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SnapTradeLoginUserRequestBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SnapTradeLoginUserRequestBody value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SnapTradeLoginUserRequestBody read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + SnapTradeLoginUserRequestBody instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SnapTradeLoginUserRequestBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of SnapTradeLoginUserRequestBody + * @throws IOException if the JSON string is invalid with respect to SnapTradeLoginUserRequestBody + */ + public static SnapTradeLoginUserRequestBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SnapTradeLoginUserRequestBody.class); + } + + /** + * Convert an instance of SnapTradeLoginUserRequestBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/SnapTradeRegisterUserRequestBody.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/SnapTradeRegisterUserRequestBody.java new file mode 100644 index 0000000000..7e3939f2e1 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/SnapTradeRegisterUserRequestBody.java @@ -0,0 +1,291 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Data required to register a user via SnapTrade Partner + */ +@ApiModel(description = "Data required to register a user via SnapTrade Partner")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class SnapTradeRegisterUserRequestBody { + public static final String SERIALIZED_NAME_USER_ID = "userId"; + @SerializedName(SERIALIZED_NAME_USER_ID) + private String userId; + + public SnapTradeRegisterUserRequestBody() { + } + + public SnapTradeRegisterUserRequestBody userId(String userId) { + + + + + this.userId = userId; + return this; + } + + /** + * SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable. + * @return userId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "snaptrade-user-123", value = "SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.") + + public String getUserId() { + return userId; + } + + + public void setUserId(String userId) { + + + + this.userId = userId; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SnapTradeRegisterUserRequestBody instance itself + */ + public SnapTradeRegisterUserRequestBody putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SnapTradeRegisterUserRequestBody snapTradeRegisterUserRequestBody = (SnapTradeRegisterUserRequestBody) o; + return Objects.equals(this.userId, snapTradeRegisterUserRequestBody.userId)&& + Objects.equals(this.additionalProperties, snapTradeRegisterUserRequestBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(userId, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SnapTradeRegisterUserRequestBody {\n"); + sb.append(" userId: ").append(toIndentedString(userId)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("userId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to SnapTradeRegisterUserRequestBody + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!SnapTradeRegisterUserRequestBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SnapTradeRegisterUserRequestBody is not found in the empty JSON string", SnapTradeRegisterUserRequestBody.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("userId") != null && !jsonObj.get("userId").isJsonNull()) && !jsonObj.get("userId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `userId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("userId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SnapTradeRegisterUserRequestBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SnapTradeRegisterUserRequestBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SnapTradeRegisterUserRequestBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SnapTradeRegisterUserRequestBody value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SnapTradeRegisterUserRequestBody read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + SnapTradeRegisterUserRequestBody instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SnapTradeRegisterUserRequestBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of SnapTradeRegisterUserRequestBody + * @throws IOException if the JSON string is invalid with respect to SnapTradeRegisterUserRequestBody + */ + public static SnapTradeRegisterUserRequestBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SnapTradeRegisterUserRequestBody.class); + } + + /** + * Convert an instance of SnapTradeRegisterUserRequestBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/Status.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/Status.java new file mode 100644 index 0000000000..410d154811 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/Status.java @@ -0,0 +1,363 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Status of API + */ +@ApiModel(description = "Status of API")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class Status { + public static final String SERIALIZED_NAME_VERSION = "version"; + @SerializedName(SERIALIZED_NAME_VERSION) + private Integer version; + + public static final String SERIALIZED_NAME_TIMESTAMP = "timestamp"; + @SerializedName(SERIALIZED_NAME_TIMESTAMP) + private String timestamp; + + public static final String SERIALIZED_NAME_ONLINE = "online"; + @SerializedName(SERIALIZED_NAME_ONLINE) + private Boolean online; + + public Status() { + } + + public Status version(Integer version) { + + + + + this.version = version; + return this; + } + + /** + * Get version + * @return version + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "151", value = "") + + public Integer getVersion() { + return version; + } + + + public void setVersion(Integer version) { + + + + this.version = version; + } + + + public Status timestamp(String timestamp) { + + + + + this.timestamp = timestamp; + return this; + } + + /** + * Get timestamp + * @return timestamp + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2022-11-04T01:47:00.377Z", value = "") + + public String getTimestamp() { + return timestamp; + } + + + public void setTimestamp(String timestamp) { + + + + this.timestamp = timestamp; + } + + + public Status online(Boolean online) { + + + + + this.online = online; + return this; + } + + /** + * Get online + * @return online + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "true", value = "") + + public Boolean getOnline() { + return online; + } + + + public void setOnline(Boolean online) { + + + + this.online = online; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Status instance itself + */ + public Status putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Status status = (Status) o; + return Objects.equals(this.version, status.version) && + Objects.equals(this.timestamp, status.timestamp) && + Objects.equals(this.online, status.online)&& + Objects.equals(this.additionalProperties, status.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(version, timestamp, online, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Status {\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + sb.append(" online: ").append(toIndentedString(online)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("version"); + openapiFields.add("timestamp"); + openapiFields.add("online"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to Status + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!Status.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Status is not found in the empty JSON string", Status.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("timestamp") != null && !jsonObj.get("timestamp").isJsonNull()) && !jsonObj.get("timestamp").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `timestamp` to be a primitive type in the JSON string but got `%s`", jsonObj.get("timestamp").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Status.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Status' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Status.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Status value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Status read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + Status instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Status given an JSON string + * + * @param jsonString JSON string + * @return An instance of Status + * @throws IOException if the JSON string is invalid with respect to Status + */ + public static Status fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Status.class); + } + + /** + * Convert an instance of Status to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/StrategyImpact.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/StrategyImpact.java new file mode 100644 index 0000000000..69c5f1f89c --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/StrategyImpact.java @@ -0,0 +1,739 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.StrategyImpactLegsInner; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * The strategy impact + */ +@ApiModel(description = "The strategy impact")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class StrategyImpact { + public static final String SERIALIZED_NAME_ESTIMATED_COMMISSIONS = "estimatedCommissions"; + @SerializedName(SERIALIZED_NAME_ESTIMATED_COMMISSIONS) + private Double estimatedCommissions; + + public static final String SERIALIZED_NAME_BUYING_POWER_EFFECT = "buyingPowerEffect"; + @SerializedName(SERIALIZED_NAME_BUYING_POWER_EFFECT) + private Double buyingPowerEffect; + + public static final String SERIALIZED_NAME_BUYING_POWER_RESULT = "buyingPowerResult"; + @SerializedName(SERIALIZED_NAME_BUYING_POWER_RESULT) + private Double buyingPowerResult; + + public static final String SERIALIZED_NAME_MAINT_EXCESS_EFFECT = "maintExcessEffect"; + @SerializedName(SERIALIZED_NAME_MAINT_EXCESS_EFFECT) + private Double maintExcessEffect; + + public static final String SERIALIZED_NAME_MAINT_EXCESS_RESULT = "maintExcessResult"; + @SerializedName(SERIALIZED_NAME_MAINT_EXCESS_RESULT) + private Double maintExcessResult; + + public static final String SERIALIZED_NAME_TRADE_VALUE_CALCULATION = "tradeValueCalculation"; + @SerializedName(SERIALIZED_NAME_TRADE_VALUE_CALCULATION) + private String tradeValueCalculation; + + public static final String SERIALIZED_NAME_LEGS = "legs"; + @SerializedName(SERIALIZED_NAME_LEGS) + private List legs = null; + + public static final String SERIALIZED_NAME_SIDE = "side"; + @SerializedName(SERIALIZED_NAME_SIDE) + private String side; + + public static final String SERIALIZED_NAME_EFFECT = "effect"; + @SerializedName(SERIALIZED_NAME_EFFECT) + private String effect; + + public static final String SERIALIZED_NAME_PRICE = "price"; + @SerializedName(SERIALIZED_NAME_PRICE) + private Double price; + + public static final String SERIALIZED_NAME_STRATEGY = "strategy"; + @SerializedName(SERIALIZED_NAME_STRATEGY) + private String strategy; + + public StrategyImpact() { + } + + public StrategyImpact estimatedCommissions(Double estimatedCommissions) { + + + + + this.estimatedCommissions = estimatedCommissions; + return this; + } + + public StrategyImpact estimatedCommissions(Integer estimatedCommissions) { + + + + + this.estimatedCommissions = estimatedCommissions.doubleValue(); + return this; + } + + /** + * Get estimatedCommissions + * @return estimatedCommissions + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "11.95", value = "") + + public Double getEstimatedCommissions() { + return estimatedCommissions; + } + + + public void setEstimatedCommissions(Double estimatedCommissions) { + + + + this.estimatedCommissions = estimatedCommissions; + } + + + public StrategyImpact buyingPowerEffect(Double buyingPowerEffect) { + + + + + this.buyingPowerEffect = buyingPowerEffect; + return this; + } + + public StrategyImpact buyingPowerEffect(Integer buyingPowerEffect) { + + + + + this.buyingPowerEffect = buyingPowerEffect.doubleValue(); + return this; + } + + /** + * Get buyingPowerEffect + * @return buyingPowerEffect + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "-156.3435", value = "") + + public Double getBuyingPowerEffect() { + return buyingPowerEffect; + } + + + public void setBuyingPowerEffect(Double buyingPowerEffect) { + + + + this.buyingPowerEffect = buyingPowerEffect; + } + + + public StrategyImpact buyingPowerResult(Double buyingPowerResult) { + + + + + this.buyingPowerResult = buyingPowerResult; + return this; + } + + public StrategyImpact buyingPowerResult(Integer buyingPowerResult) { + + + + + this.buyingPowerResult = buyingPowerResult.doubleValue(); + return this; + } + + /** + * Get buyingPowerResult + * @return buyingPowerResult + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "8800.0882", value = "") + + public Double getBuyingPowerResult() { + return buyingPowerResult; + } + + + public void setBuyingPowerResult(Double buyingPowerResult) { + + + + this.buyingPowerResult = buyingPowerResult; + } + + + public StrategyImpact maintExcessEffect(Double maintExcessEffect) { + + + + + this.maintExcessEffect = maintExcessEffect; + return this; + } + + public StrategyImpact maintExcessEffect(Integer maintExcessEffect) { + + + + + this.maintExcessEffect = maintExcessEffect.doubleValue(); + return this; + } + + /** + * Get maintExcessEffect + * @return maintExcessEffect + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "-46.95", value = "") + + public Double getMaintExcessEffect() { + return maintExcessEffect; + } + + + public void setMaintExcessEffect(Double maintExcessEffect) { + + + + this.maintExcessEffect = maintExcessEffect; + } + + + public StrategyImpact maintExcessResult(Double maintExcessResult) { + + + + + this.maintExcessResult = maintExcessResult; + return this; + } + + public StrategyImpact maintExcessResult(Integer maintExcessResult) { + + + + + this.maintExcessResult = maintExcessResult.doubleValue(); + return this; + } + + /** + * Get maintExcessResult + * @return maintExcessResult + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2642.669129", value = "") + + public Double getMaintExcessResult() { + return maintExcessResult; + } + + + public void setMaintExcessResult(Double maintExcessResult) { + + + + this.maintExcessResult = maintExcessResult; + } + + + public StrategyImpact tradeValueCalculation(String tradeValueCalculation) { + + + + + this.tradeValueCalculation = tradeValueCalculation; + return this; + } + + /** + * Get tradeValueCalculation + * @return tradeValueCalculation + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "1 x 0.07 x 100 + 1 x 0.28 x 100 = DR 35.00 CAD", value = "") + + public String getTradeValueCalculation() { + return tradeValueCalculation; + } + + + public void setTradeValueCalculation(String tradeValueCalculation) { + + + + this.tradeValueCalculation = tradeValueCalculation; + } + + + public StrategyImpact legs(List legs) { + + + + + this.legs = legs; + return this; + } + + public StrategyImpact addLegsItem(StrategyImpactLegsInner legsItem) { + if (this.legs == null) { + this.legs = new ArrayList<>(); + } + this.legs.add(legsItem); + return this; + } + + /** + * Get legs + * @return legs + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public List getLegs() { + return legs; + } + + + public void setLegs(List legs) { + + + + this.legs = legs; + } + + + public StrategyImpact side(String side) { + + + + + this.side = side; + return this; + } + + /** + * Get side + * @return side + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Buy", value = "") + + public String getSide() { + return side; + } + + + public void setSide(String side) { + + + + this.side = side; + } + + + public StrategyImpact effect(String effect) { + + + + + this.effect = effect; + return this; + } + + /** + * Get effect + * @return effect + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Debit", value = "") + + public String getEffect() { + return effect; + } + + + public void setEffect(String effect) { + + + + this.effect = effect; + } + + + public StrategyImpact price(Double price) { + + + + + this.price = price; + return this; + } + + public StrategyImpact price(Integer price) { + + + + + this.price = price.doubleValue(); + return this; + } + + /** + * Get price + * @return price + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "0.35", value = "") + + public Double getPrice() { + return price; + } + + + public void setPrice(Double price) { + + + + this.price = price; + } + + + public StrategyImpact strategy(String strategy) { + + + + + this.strategy = strategy; + return this; + } + + /** + * Get strategy + * @return strategy + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Strangle", value = "") + + public String getStrategy() { + return strategy; + } + + + public void setStrategy(String strategy) { + + + + this.strategy = strategy; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the StrategyImpact instance itself + */ + public StrategyImpact putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StrategyImpact strategyImpact = (StrategyImpact) o; + return Objects.equals(this.estimatedCommissions, strategyImpact.estimatedCommissions) && + Objects.equals(this.buyingPowerEffect, strategyImpact.buyingPowerEffect) && + Objects.equals(this.buyingPowerResult, strategyImpact.buyingPowerResult) && + Objects.equals(this.maintExcessEffect, strategyImpact.maintExcessEffect) && + Objects.equals(this.maintExcessResult, strategyImpact.maintExcessResult) && + Objects.equals(this.tradeValueCalculation, strategyImpact.tradeValueCalculation) && + Objects.equals(this.legs, strategyImpact.legs) && + Objects.equals(this.side, strategyImpact.side) && + Objects.equals(this.effect, strategyImpact.effect) && + Objects.equals(this.price, strategyImpact.price) && + Objects.equals(this.strategy, strategyImpact.strategy)&& + Objects.equals(this.additionalProperties, strategyImpact.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(estimatedCommissions, buyingPowerEffect, buyingPowerResult, maintExcessEffect, maintExcessResult, tradeValueCalculation, legs, side, effect, price, strategy, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StrategyImpact {\n"); + sb.append(" estimatedCommissions: ").append(toIndentedString(estimatedCommissions)).append("\n"); + sb.append(" buyingPowerEffect: ").append(toIndentedString(buyingPowerEffect)).append("\n"); + sb.append(" buyingPowerResult: ").append(toIndentedString(buyingPowerResult)).append("\n"); + sb.append(" maintExcessEffect: ").append(toIndentedString(maintExcessEffect)).append("\n"); + sb.append(" maintExcessResult: ").append(toIndentedString(maintExcessResult)).append("\n"); + sb.append(" tradeValueCalculation: ").append(toIndentedString(tradeValueCalculation)).append("\n"); + sb.append(" legs: ").append(toIndentedString(legs)).append("\n"); + sb.append(" side: ").append(toIndentedString(side)).append("\n"); + sb.append(" effect: ").append(toIndentedString(effect)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append(" strategy: ").append(toIndentedString(strategy)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("estimatedCommissions"); + openapiFields.add("buyingPowerEffect"); + openapiFields.add("buyingPowerResult"); + openapiFields.add("maintExcessEffect"); + openapiFields.add("maintExcessResult"); + openapiFields.add("tradeValueCalculation"); + openapiFields.add("legs"); + openapiFields.add("side"); + openapiFields.add("effect"); + openapiFields.add("price"); + openapiFields.add("strategy"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to StrategyImpact + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!StrategyImpact.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StrategyImpact is not found in the empty JSON string", StrategyImpact.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("tradeValueCalculation") != null && !jsonObj.get("tradeValueCalculation").isJsonNull()) && !jsonObj.get("tradeValueCalculation").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `tradeValueCalculation` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tradeValueCalculation").toString())); + } + if (jsonObj.get("legs") != null && !jsonObj.get("legs").isJsonNull()) { + JsonArray jsonArraylegs = jsonObj.getAsJsonArray("legs"); + if (jsonArraylegs != null) { + // ensure the json data is an array + if (!jsonObj.get("legs").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `legs` to be an array in the JSON string but got `%s`", jsonObj.get("legs").toString())); + } + + // validate the optional field `legs` (array) + for (int i = 0; i < jsonArraylegs.size(); i++) { + StrategyImpactLegsInner.validateJsonObject(jsonArraylegs.get(i).getAsJsonObject()); + }; + } + } + if ((jsonObj.get("side") != null && !jsonObj.get("side").isJsonNull()) && !jsonObj.get("side").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `side` to be a primitive type in the JSON string but got `%s`", jsonObj.get("side").toString())); + } + if ((jsonObj.get("effect") != null && !jsonObj.get("effect").isJsonNull()) && !jsonObj.get("effect").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `effect` to be a primitive type in the JSON string but got `%s`", jsonObj.get("effect").toString())); + } + if ((jsonObj.get("strategy") != null && !jsonObj.get("strategy").isJsonNull()) && !jsonObj.get("strategy").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `strategy` to be a primitive type in the JSON string but got `%s`", jsonObj.get("strategy").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StrategyImpact.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StrategyImpact' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StrategyImpact.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StrategyImpact value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public StrategyImpact read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + StrategyImpact instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StrategyImpact given an JSON string + * + * @param jsonString JSON string + * @return An instance of StrategyImpact + * @throws IOException if the JSON string is invalid with respect to StrategyImpact + */ + public static StrategyImpact fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StrategyImpact.class); + } + + /** + * Convert an instance of StrategyImpact to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/StrategyImpactLegsInner.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/StrategyImpactLegsInner.java new file mode 100644 index 0000000000..e56c948ad5 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/StrategyImpactLegsInner.java @@ -0,0 +1,515 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * StrategyImpactLegsInner + */@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class StrategyImpactLegsInner { + public static final String SERIALIZED_NAME_LEG_ID = "legId"; + @SerializedName(SERIALIZED_NAME_LEG_ID) + private Integer legId; + + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + @SerializedName(SERIALIZED_NAME_SYMBOL) + private String symbol; + + public static final String SERIALIZED_NAME_SYMBOL_ID = "symbolId"; + @SerializedName(SERIALIZED_NAME_SYMBOL_ID) + private Integer symbolId; + + public static final String SERIALIZED_NAME_LEG_RATIO_QUANTITY = "legRatioQuantity"; + @SerializedName(SERIALIZED_NAME_LEG_RATIO_QUANTITY) + private Integer legRatioQuantity; + + public static final String SERIALIZED_NAME_SIDE = "side"; + @SerializedName(SERIALIZED_NAME_SIDE) + private String side; + + public static final String SERIALIZED_NAME_AVG_EXEC_PRICE = "avgExecPrice"; + @SerializedName(SERIALIZED_NAME_AVG_EXEC_PRICE) + private String avgExecPrice; + + public static final String SERIALIZED_NAME_LAST_EXEC_PRICE = "lastExecPrice"; + @SerializedName(SERIALIZED_NAME_LAST_EXEC_PRICE) + private String lastExecPrice; + + public StrategyImpactLegsInner() { + } + + public StrategyImpactLegsInner legId(Integer legId) { + + + + + this.legId = legId; + return this; + } + + /** + * Get legId + * @return legId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "0", value = "") + + public Integer getLegId() { + return legId; + } + + + public void setLegId(Integer legId) { + + + + this.legId = legId; + } + + + public StrategyImpactLegsInner symbol(String symbol) { + + + + + this.symbol = symbol; + return this; + } + + /** + * Get symbol + * @return symbol + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "AC21Oct22C30.00.MX", value = "") + + public String getSymbol() { + return symbol; + } + + + public void setSymbol(String symbol) { + + + + this.symbol = symbol; + } + + + public StrategyImpactLegsInner symbolId(Integer symbolId) { + + + + + this.symbolId = symbolId; + return this; + } + + /** + * Get symbolId + * @return symbolId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "41790511", value = "") + + public Integer getSymbolId() { + return symbolId; + } + + + public void setSymbolId(Integer symbolId) { + + + + this.symbolId = symbolId; + } + + + public StrategyImpactLegsInner legRatioQuantity(Integer legRatioQuantity) { + + + + + this.legRatioQuantity = legRatioQuantity; + return this; + } + + /** + * Get legRatioQuantity + * @return legRatioQuantity + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "1", value = "") + + public Integer getLegRatioQuantity() { + return legRatioQuantity; + } + + + public void setLegRatioQuantity(Integer legRatioQuantity) { + + + + this.legRatioQuantity = legRatioQuantity; + } + + + public StrategyImpactLegsInner side(String side) { + + + + + this.side = side; + return this; + } + + /** + * Get side + * @return side + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "BTO", value = "") + + public String getSide() { + return side; + } + + + public void setSide(String side) { + + + + this.side = side; + } + + + public StrategyImpactLegsInner avgExecPrice(String avgExecPrice) { + + + + + this.avgExecPrice = avgExecPrice; + return this; + } + + /** + * Get avgExecPrice + * @return avgExecPrice + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public String getAvgExecPrice() { + return avgExecPrice; + } + + + public void setAvgExecPrice(String avgExecPrice) { + + + + this.avgExecPrice = avgExecPrice; + } + + + public StrategyImpactLegsInner lastExecPrice(String lastExecPrice) { + + + + + this.lastExecPrice = lastExecPrice; + return this; + } + + /** + * Get lastExecPrice + * @return lastExecPrice + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public String getLastExecPrice() { + return lastExecPrice; + } + + + public void setLastExecPrice(String lastExecPrice) { + + + + this.lastExecPrice = lastExecPrice; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the StrategyImpactLegsInner instance itself + */ + public StrategyImpactLegsInner putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StrategyImpactLegsInner strategyImpactLegsInner = (StrategyImpactLegsInner) o; + return Objects.equals(this.legId, strategyImpactLegsInner.legId) && + Objects.equals(this.symbol, strategyImpactLegsInner.symbol) && + Objects.equals(this.symbolId, strategyImpactLegsInner.symbolId) && + Objects.equals(this.legRatioQuantity, strategyImpactLegsInner.legRatioQuantity) && + Objects.equals(this.side, strategyImpactLegsInner.side) && + Objects.equals(this.avgExecPrice, strategyImpactLegsInner.avgExecPrice) && + Objects.equals(this.lastExecPrice, strategyImpactLegsInner.lastExecPrice)&& + Objects.equals(this.additionalProperties, strategyImpactLegsInner.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(legId, symbol, symbolId, legRatioQuantity, side, avgExecPrice, lastExecPrice, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StrategyImpactLegsInner {\n"); + sb.append(" legId: ").append(toIndentedString(legId)).append("\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" symbolId: ").append(toIndentedString(symbolId)).append("\n"); + sb.append(" legRatioQuantity: ").append(toIndentedString(legRatioQuantity)).append("\n"); + sb.append(" side: ").append(toIndentedString(side)).append("\n"); + sb.append(" avgExecPrice: ").append(toIndentedString(avgExecPrice)).append("\n"); + sb.append(" lastExecPrice: ").append(toIndentedString(lastExecPrice)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("legId"); + openapiFields.add("symbol"); + openapiFields.add("symbolId"); + openapiFields.add("legRatioQuantity"); + openapiFields.add("side"); + openapiFields.add("avgExecPrice"); + openapiFields.add("lastExecPrice"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to StrategyImpactLegsInner + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!StrategyImpactLegsInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StrategyImpactLegsInner is not found in the empty JSON string", StrategyImpactLegsInner.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("symbol") != null && !jsonObj.get("symbol").isJsonNull()) && !jsonObj.get("symbol").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `symbol` to be a primitive type in the JSON string but got `%s`", jsonObj.get("symbol").toString())); + } + if ((jsonObj.get("side") != null && !jsonObj.get("side").isJsonNull()) && !jsonObj.get("side").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `side` to be a primitive type in the JSON string but got `%s`", jsonObj.get("side").toString())); + } + if ((jsonObj.get("avgExecPrice") != null && !jsonObj.get("avgExecPrice").isJsonNull()) && !jsonObj.get("avgExecPrice").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `avgExecPrice` to be a primitive type in the JSON string but got `%s`", jsonObj.get("avgExecPrice").toString())); + } + if ((jsonObj.get("lastExecPrice") != null && !jsonObj.get("lastExecPrice").isJsonNull()) && !jsonObj.get("lastExecPrice").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lastExecPrice` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastExecPrice").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StrategyImpactLegsInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StrategyImpactLegsInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StrategyImpactLegsInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StrategyImpactLegsInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public StrategyImpactLegsInner read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + StrategyImpactLegsInner instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StrategyImpactLegsInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of StrategyImpactLegsInner + * @throws IOException if the JSON string is invalid with respect to StrategyImpactLegsInner + */ + public static StrategyImpactLegsInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StrategyImpactLegsInner.class); + } + + /** + * Convert an instance of StrategyImpactLegsInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/StrategyOrderPlace.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/StrategyOrderPlace.java new file mode 100644 index 0000000000..d70d361cb0 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/StrategyOrderPlace.java @@ -0,0 +1,349 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.StrategyOrderPlaceOrdersInner; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * The reponse for a correctly placed order + */ +@ApiModel(description = "The reponse for a correctly placed order")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class StrategyOrderPlace { + public static final String SERIALIZED_NAME_ORDER_ID = "orderId"; + @SerializedName(SERIALIZED_NAME_ORDER_ID) + private Integer orderId; + + public static final String SERIALIZED_NAME_ORDERS = "orders"; + @SerializedName(SERIALIZED_NAME_ORDERS) + private List orders = null; + + public StrategyOrderPlace() { + } + + public StrategyOrderPlace orderId(Integer orderId) { + + + + + this.orderId = orderId; + return this; + } + + /** + * Get orderId + * @return orderId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "1069605761", value = "") + + public Integer getOrderId() { + return orderId; + } + + + public void setOrderId(Integer orderId) { + + + + this.orderId = orderId; + } + + + public StrategyOrderPlace orders(List orders) { + + + + + this.orders = orders; + return this; + } + + public StrategyOrderPlace addOrdersItem(StrategyOrderPlaceOrdersInner ordersItem) { + if (this.orders == null) { + this.orders = new ArrayList<>(); + } + this.orders.add(ordersItem); + return this; + } + + /** + * Get orders + * @return orders + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public List getOrders() { + return orders; + } + + + public void setOrders(List orders) { + + + + this.orders = orders; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the StrategyOrderPlace instance itself + */ + public StrategyOrderPlace putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StrategyOrderPlace strategyOrderPlace = (StrategyOrderPlace) o; + return Objects.equals(this.orderId, strategyOrderPlace.orderId) && + Objects.equals(this.orders, strategyOrderPlace.orders)&& + Objects.equals(this.additionalProperties, strategyOrderPlace.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(orderId, orders, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StrategyOrderPlace {\n"); + sb.append(" orderId: ").append(toIndentedString(orderId)).append("\n"); + sb.append(" orders: ").append(toIndentedString(orders)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("orderId"); + openapiFields.add("orders"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to StrategyOrderPlace + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!StrategyOrderPlace.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StrategyOrderPlace is not found in the empty JSON string", StrategyOrderPlace.openapiRequiredFields.toString())); + } + } + if (jsonObj.get("orders") != null && !jsonObj.get("orders").isJsonNull()) { + JsonArray jsonArrayorders = jsonObj.getAsJsonArray("orders"); + if (jsonArrayorders != null) { + // ensure the json data is an array + if (!jsonObj.get("orders").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `orders` to be an array in the JSON string but got `%s`", jsonObj.get("orders").toString())); + } + + // validate the optional field `orders` (array) + for (int i = 0; i < jsonArrayorders.size(); i++) { + StrategyOrderPlaceOrdersInner.validateJsonObject(jsonArrayorders.get(i).getAsJsonObject()); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StrategyOrderPlace.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StrategyOrderPlace' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StrategyOrderPlace.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StrategyOrderPlace value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public StrategyOrderPlace read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + StrategyOrderPlace instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StrategyOrderPlace given an JSON string + * + * @param jsonString JSON string + * @return An instance of StrategyOrderPlace + * @throws IOException if the JSON string is invalid with respect to StrategyOrderPlace + */ + public static StrategyOrderPlace fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StrategyOrderPlace.class); + } + + /** + * Convert an instance of StrategyOrderPlace to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/StrategyOrderPlaceOrdersInner.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/StrategyOrderPlaceOrdersInner.java new file mode 100644 index 0000000000..dcfa3db2a1 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/StrategyOrderPlaceOrdersInner.java @@ -0,0 +1,1899 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.StrategyOrderPlaceOrdersInnerLegsInner; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * StrategyOrderPlaceOrdersInner + */@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class StrategyOrderPlaceOrdersInner { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private Integer id; + + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + @SerializedName(SERIALIZED_NAME_SYMBOL) + private String symbol; + + public static final String SERIALIZED_NAME_SYMBOL_ID = "symbolId"; + @SerializedName(SERIALIZED_NAME_SYMBOL_ID) + private Integer symbolId; + + public static final String SERIALIZED_NAME_TOTAL_QUANTITY = "totalQuantity"; + @SerializedName(SERIALIZED_NAME_TOTAL_QUANTITY) + private Integer totalQuantity; + + public static final String SERIALIZED_NAME_OPEN_QUANTITY = "openQuantity"; + @SerializedName(SERIALIZED_NAME_OPEN_QUANTITY) + private Integer openQuantity; + + public static final String SERIALIZED_NAME_FILLED_QUANTITY = "filledQuantity"; + @SerializedName(SERIALIZED_NAME_FILLED_QUANTITY) + private Integer filledQuantity; + + public static final String SERIALIZED_NAME_CANCELED_QUANTITY = "canceledQuantity"; + @SerializedName(SERIALIZED_NAME_CANCELED_QUANTITY) + private Integer canceledQuantity; + + public static final String SERIALIZED_NAME_SIDE = "side"; + @SerializedName(SERIALIZED_NAME_SIDE) + private String side; + + public static final String SERIALIZED_NAME_ORDER_TYPE = "orderType"; + @SerializedName(SERIALIZED_NAME_ORDER_TYPE) + private String orderType; + + public static final String SERIALIZED_NAME_LIMIT_PRICE = "limitPrice"; + @SerializedName(SERIALIZED_NAME_LIMIT_PRICE) + private String limitPrice; + + public static final String SERIALIZED_NAME_STOP_PRICE = "stopPrice"; + @SerializedName(SERIALIZED_NAME_STOP_PRICE) + private String stopPrice; + + public static final String SERIALIZED_NAME_IS_ALL_OR_NONE = "isAllOrNone"; + @SerializedName(SERIALIZED_NAME_IS_ALL_OR_NONE) + private Boolean isAllOrNone; + + public static final String SERIALIZED_NAME_IS_ANONYMOUS = "isAnonymous"; + @SerializedName(SERIALIZED_NAME_IS_ANONYMOUS) + private Boolean isAnonymous; + + public static final String SERIALIZED_NAME_ICEBERG_QUANTITY = "icebergQuantity"; + @SerializedName(SERIALIZED_NAME_ICEBERG_QUANTITY) + private String icebergQuantity; + + public static final String SERIALIZED_NAME_MIN_QUANTITY = "minQuantity"; + @SerializedName(SERIALIZED_NAME_MIN_QUANTITY) + private String minQuantity; + + public static final String SERIALIZED_NAME_AVG_EXEC_PRICE = "avgExecPrice"; + @SerializedName(SERIALIZED_NAME_AVG_EXEC_PRICE) + private Integer avgExecPrice; + + public static final String SERIALIZED_NAME_LAST_EXEC_PRICE = "lastExecPrice"; + @SerializedName(SERIALIZED_NAME_LAST_EXEC_PRICE) + private String lastExecPrice; + + public static final String SERIALIZED_NAME_SOURCE = "source"; + @SerializedName(SERIALIZED_NAME_SOURCE) + private String source; + + public static final String SERIALIZED_NAME_TIME_IN_FORCE = "timeInForce"; + @SerializedName(SERIALIZED_NAME_TIME_IN_FORCE) + private String timeInForce; + + public static final String SERIALIZED_NAME_GTD_DATE = "gtdDate"; + @SerializedName(SERIALIZED_NAME_GTD_DATE) + private String gtdDate; + + public static final String SERIALIZED_NAME_STATE = "state"; + @SerializedName(SERIALIZED_NAME_STATE) + private String state; + + public static final String SERIALIZED_NAME_REJECTION_REASON = "rejectionReason"; + @SerializedName(SERIALIZED_NAME_REJECTION_REASON) + private String rejectionReason; + + public static final String SERIALIZED_NAME_CHAIN_ID = "chainId"; + @SerializedName(SERIALIZED_NAME_CHAIN_ID) + private Integer chainId; + + public static final String SERIALIZED_NAME_CREATION_TIME = "creationTime"; + @SerializedName(SERIALIZED_NAME_CREATION_TIME) + private String creationTime; + + public static final String SERIALIZED_NAME_UPDATE_TIME = "updateTime"; + @SerializedName(SERIALIZED_NAME_UPDATE_TIME) + private String updateTime; + + public static final String SERIALIZED_NAME_NOTES = "notes"; + @SerializedName(SERIALIZED_NAME_NOTES) + private String notes; + + public static final String SERIALIZED_NAME_PRIMARY_ROUTE = "primaryRoute"; + @SerializedName(SERIALIZED_NAME_PRIMARY_ROUTE) + private String primaryRoute; + + public static final String SERIALIZED_NAME_SECONDARY_ROUTE = "secondaryRoute"; + @SerializedName(SERIALIZED_NAME_SECONDARY_ROUTE) + private String secondaryRoute; + + public static final String SERIALIZED_NAME_ORDER_ROUTE = "orderRoute"; + @SerializedName(SERIALIZED_NAME_ORDER_ROUTE) + private String orderRoute; + + public static final String SERIALIZED_NAME_VENUE_HOLDING_ORDER = "venueHoldingOrder"; + @SerializedName(SERIALIZED_NAME_VENUE_HOLDING_ORDER) + private String venueHoldingOrder; + + public static final String SERIALIZED_NAME_COMISSION_CHARGED = "comissionCharged"; + @SerializedName(SERIALIZED_NAME_COMISSION_CHARGED) + private Integer comissionCharged; + + public static final String SERIALIZED_NAME_EXCHANGE_ORDER_ID = "exchangeOrderId"; + @SerializedName(SERIALIZED_NAME_EXCHANGE_ORDER_ID) + private String exchangeOrderId; + + public static final String SERIALIZED_NAME_IS_SIGNIFICANT_SHARE_HOLDER = "isSignificantShareHolder"; + @SerializedName(SERIALIZED_NAME_IS_SIGNIFICANT_SHARE_HOLDER) + private Boolean isSignificantShareHolder; + + public static final String SERIALIZED_NAME_IS_INSIDER = "isInsider"; + @SerializedName(SERIALIZED_NAME_IS_INSIDER) + private Boolean isInsider; + + public static final String SERIALIZED_NAME_IS_LIMIT_OFFSET_IN_DOLLAR = "isLimitOffsetInDollar"; + @SerializedName(SERIALIZED_NAME_IS_LIMIT_OFFSET_IN_DOLLAR) + private Boolean isLimitOffsetInDollar; + + public static final String SERIALIZED_NAME_USER_ID = "userId"; + @SerializedName(SERIALIZED_NAME_USER_ID) + private Integer userId; + + public static final String SERIALIZED_NAME_PLACEMENT_COMMISSION = "placementCommission"; + @SerializedName(SERIALIZED_NAME_PLACEMENT_COMMISSION) + private String placementCommission; + + public static final String SERIALIZED_NAME_LEGS = "legs"; + @SerializedName(SERIALIZED_NAME_LEGS) + private List legs = null; + + public static final String SERIALIZED_NAME_STRATEGY_TYPE = "strategyType"; + @SerializedName(SERIALIZED_NAME_STRATEGY_TYPE) + private String strategyType; + + public static final String SERIALIZED_NAME_TRIGGER_STOP_PRICE = "triggerStopPrice"; + @SerializedName(SERIALIZED_NAME_TRIGGER_STOP_PRICE) + private String triggerStopPrice; + + public static final String SERIALIZED_NAME_ORDER_GROUP_ID = "orderGroupId"; + @SerializedName(SERIALIZED_NAME_ORDER_GROUP_ID) + private Integer orderGroupId; + + public static final String SERIALIZED_NAME_ORDER_CLASS = "orderClass"; + @SerializedName(SERIALIZED_NAME_ORDER_CLASS) + private String orderClass; + + public static final String SERIALIZED_NAME_IS_CROSS_ZERO = "isCrossZero"; + @SerializedName(SERIALIZED_NAME_IS_CROSS_ZERO) + private Boolean isCrossZero; + + public StrategyOrderPlaceOrdersInner() { + } + + public StrategyOrderPlaceOrdersInner id(Integer id) { + + + + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "1069605761", value = "") + + public Integer getId() { + return id; + } + + + public void setId(Integer id) { + + + + this.id = id; + } + + + public StrategyOrderPlaceOrdersInner symbol(String symbol) { + + + + + this.symbol = symbol; + return this; + } + + /** + * Get symbol + * @return symbol + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "AC.TO", value = "") + + public String getSymbol() { + return symbol; + } + + + public void setSymbol(String symbol) { + + + + this.symbol = symbol; + } + + + public StrategyOrderPlaceOrdersInner symbolId(Integer symbolId) { + + + + + this.symbolId = symbolId; + return this; + } + + /** + * Get symbolId + * @return symbolId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "7960447", value = "") + + public Integer getSymbolId() { + return symbolId; + } + + + public void setSymbolId(Integer symbolId) { + + + + this.symbolId = symbolId; + } + + + public StrategyOrderPlaceOrdersInner totalQuantity(Integer totalQuantity) { + + + + + this.totalQuantity = totalQuantity; + return this; + } + + /** + * Get totalQuantity + * @return totalQuantity + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "1", value = "") + + public Integer getTotalQuantity() { + return totalQuantity; + } + + + public void setTotalQuantity(Integer totalQuantity) { + + + + this.totalQuantity = totalQuantity; + } + + + public StrategyOrderPlaceOrdersInner openQuantity(Integer openQuantity) { + + + + + this.openQuantity = openQuantity; + return this; + } + + /** + * Get openQuantity + * @return openQuantity + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "1", value = "") + + public Integer getOpenQuantity() { + return openQuantity; + } + + + public void setOpenQuantity(Integer openQuantity) { + + + + this.openQuantity = openQuantity; + } + + + public StrategyOrderPlaceOrdersInner filledQuantity(Integer filledQuantity) { + + + + + this.filledQuantity = filledQuantity; + return this; + } + + /** + * Get filledQuantity + * @return filledQuantity + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "0", value = "") + + public Integer getFilledQuantity() { + return filledQuantity; + } + + + public void setFilledQuantity(Integer filledQuantity) { + + + + this.filledQuantity = filledQuantity; + } + + + public StrategyOrderPlaceOrdersInner canceledQuantity(Integer canceledQuantity) { + + + + + this.canceledQuantity = canceledQuantity; + return this; + } + + /** + * Get canceledQuantity + * @return canceledQuantity + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "0", value = "") + + public Integer getCanceledQuantity() { + return canceledQuantity; + } + + + public void setCanceledQuantity(Integer canceledQuantity) { + + + + this.canceledQuantity = canceledQuantity; + } + + + public StrategyOrderPlaceOrdersInner side(String side) { + + + + + this.side = side; + return this; + } + + /** + * Get side + * @return side + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Buy", value = "") + + public String getSide() { + return side; + } + + + public void setSide(String side) { + + + + this.side = side; + } + + + public StrategyOrderPlaceOrdersInner orderType(String orderType) { + + + + + this.orderType = orderType; + return this; + } + + /** + * Get orderType + * @return orderType + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Market", value = "") + + public String getOrderType() { + return orderType; + } + + + public void setOrderType(String orderType) { + + + + this.orderType = orderType; + } + + + public StrategyOrderPlaceOrdersInner limitPrice(String limitPrice) { + + + + + this.limitPrice = limitPrice; + return this; + } + + /** + * Get limitPrice + * @return limitPrice + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public String getLimitPrice() { + return limitPrice; + } + + + public void setLimitPrice(String limitPrice) { + + + + this.limitPrice = limitPrice; + } + + + public StrategyOrderPlaceOrdersInner stopPrice(String stopPrice) { + + + + + this.stopPrice = stopPrice; + return this; + } + + /** + * Get stopPrice + * @return stopPrice + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public String getStopPrice() { + return stopPrice; + } + + + public void setStopPrice(String stopPrice) { + + + + this.stopPrice = stopPrice; + } + + + public StrategyOrderPlaceOrdersInner isAllOrNone(Boolean isAllOrNone) { + + + + + this.isAllOrNone = isAllOrNone; + return this; + } + + /** + * Get isAllOrNone + * @return isAllOrNone + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Boolean getIsAllOrNone() { + return isAllOrNone; + } + + + public void setIsAllOrNone(Boolean isAllOrNone) { + + + + this.isAllOrNone = isAllOrNone; + } + + + public StrategyOrderPlaceOrdersInner isAnonymous(Boolean isAnonymous) { + + + + + this.isAnonymous = isAnonymous; + return this; + } + + /** + * Get isAnonymous + * @return isAnonymous + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Boolean getIsAnonymous() { + return isAnonymous; + } + + + public void setIsAnonymous(Boolean isAnonymous) { + + + + this.isAnonymous = isAnonymous; + } + + + public StrategyOrderPlaceOrdersInner icebergQuantity(String icebergQuantity) { + + + + + this.icebergQuantity = icebergQuantity; + return this; + } + + /** + * Get icebergQuantity + * @return icebergQuantity + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public String getIcebergQuantity() { + return icebergQuantity; + } + + + public void setIcebergQuantity(String icebergQuantity) { + + + + this.icebergQuantity = icebergQuantity; + } + + + public StrategyOrderPlaceOrdersInner minQuantity(String minQuantity) { + + + + + this.minQuantity = minQuantity; + return this; + } + + /** + * Get minQuantity + * @return minQuantity + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public String getMinQuantity() { + return minQuantity; + } + + + public void setMinQuantity(String minQuantity) { + + + + this.minQuantity = minQuantity; + } + + + public StrategyOrderPlaceOrdersInner avgExecPrice(Integer avgExecPrice) { + + + + + this.avgExecPrice = avgExecPrice; + return this; + } + + /** + * Get avgExecPrice + * @return avgExecPrice + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "0", value = "") + + public Integer getAvgExecPrice() { + return avgExecPrice; + } + + + public void setAvgExecPrice(Integer avgExecPrice) { + + + + this.avgExecPrice = avgExecPrice; + } + + + public StrategyOrderPlaceOrdersInner lastExecPrice(String lastExecPrice) { + + + + + this.lastExecPrice = lastExecPrice; + return this; + } + + /** + * Get lastExecPrice + * @return lastExecPrice + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public String getLastExecPrice() { + return lastExecPrice; + } + + + public void setLastExecPrice(String lastExecPrice) { + + + + this.lastExecPrice = lastExecPrice; + } + + + public StrategyOrderPlaceOrdersInner source(String source) { + + + + + this.source = source; + return this; + } + + /** + * Get source + * @return source + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "TradingAPI", value = "") + + public String getSource() { + return source; + } + + + public void setSource(String source) { + + + + this.source = source; + } + + + public StrategyOrderPlaceOrdersInner timeInForce(String timeInForce) { + + + + + this.timeInForce = timeInForce; + return this; + } + + /** + * Get timeInForce + * @return timeInForce + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Day", value = "") + + public String getTimeInForce() { + return timeInForce; + } + + + public void setTimeInForce(String timeInForce) { + + + + this.timeInForce = timeInForce; + } + + + public StrategyOrderPlaceOrdersInner gtdDate(String gtdDate) { + + + + + this.gtdDate = gtdDate; + return this; + } + + /** + * Get gtdDate + * @return gtdDate + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public String getGtdDate() { + return gtdDate; + } + + + public void setGtdDate(String gtdDate) { + + + + this.gtdDate = gtdDate; + } + + + public StrategyOrderPlaceOrdersInner state(String state) { + + + + + this.state = state; + return this; + } + + /** + * Get state + * @return state + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Pending", value = "") + + public String getState() { + return state; + } + + + public void setState(String state) { + + + + this.state = state; + } + + + public StrategyOrderPlaceOrdersInner rejectionReason(String rejectionReason) { + + + + + this.rejectionReason = rejectionReason; + return this; + } + + /** + * Get rejectionReason + * @return rejectionReason + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "None", value = "") + + public String getRejectionReason() { + return rejectionReason; + } + + + public void setRejectionReason(String rejectionReason) { + + + + this.rejectionReason = rejectionReason; + } + + + public StrategyOrderPlaceOrdersInner chainId(Integer chainId) { + + + + + this.chainId = chainId; + return this; + } + + /** + * Get chainId + * @return chainId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "1069605761", value = "") + + public Integer getChainId() { + return chainId; + } + + + public void setChainId(Integer chainId) { + + + + this.chainId = chainId; + } + + + public StrategyOrderPlaceOrdersInner creationTime(String creationTime) { + + + + + this.creationTime = creationTime; + return this; + } + + /** + * Get creationTime + * @return creationTime + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2022-07-19T19:53:47.915Z", value = "") + + public String getCreationTime() { + return creationTime; + } + + + public void setCreationTime(String creationTime) { + + + + this.creationTime = creationTime; + } + + + public StrategyOrderPlaceOrdersInner updateTime(String updateTime) { + + + + + this.updateTime = updateTime; + return this; + } + + /** + * Get updateTime + * @return updateTime + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2022-07-19T19:53:47.939Z", value = "") + + public String getUpdateTime() { + return updateTime; + } + + + public void setUpdateTime(String updateTime) { + + + + this.updateTime = updateTime; + } + + + public StrategyOrderPlaceOrdersInner notes(String notes) { + + + + + this.notes = notes; + return this; + } + + /** + * Get notes + * @return notes + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "None", value = "") + + public String getNotes() { + return notes; + } + + + public void setNotes(String notes) { + + + + this.notes = notes; + } + + + public StrategyOrderPlaceOrdersInner primaryRoute(String primaryRoute) { + + + + + this.primaryRoute = primaryRoute; + return this; + } + + /** + * Get primaryRoute + * @return primaryRoute + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "AUTO", value = "") + + public String getPrimaryRoute() { + return primaryRoute; + } + + + public void setPrimaryRoute(String primaryRoute) { + + + + this.primaryRoute = primaryRoute; + } + + + public StrategyOrderPlaceOrdersInner secondaryRoute(String secondaryRoute) { + + + + + this.secondaryRoute = secondaryRoute; + return this; + } + + /** + * Get secondaryRoute + * @return secondaryRoute + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "AUTO", value = "") + + public String getSecondaryRoute() { + return secondaryRoute; + } + + + public void setSecondaryRoute(String secondaryRoute) { + + + + this.secondaryRoute = secondaryRoute; + } + + + public StrategyOrderPlaceOrdersInner orderRoute(String orderRoute) { + + + + + this.orderRoute = orderRoute; + return this; + } + + /** + * Get orderRoute + * @return orderRoute + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "MX", value = "") + + public String getOrderRoute() { + return orderRoute; + } + + + public void setOrderRoute(String orderRoute) { + + + + this.orderRoute = orderRoute; + } + + + public StrategyOrderPlaceOrdersInner venueHoldingOrder(String venueHoldingOrder) { + + + + + this.venueHoldingOrder = venueHoldingOrder; + return this; + } + + /** + * Get venueHoldingOrder + * @return venueHoldingOrder + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "None", value = "") + + public String getVenueHoldingOrder() { + return venueHoldingOrder; + } + + + public void setVenueHoldingOrder(String venueHoldingOrder) { + + + + this.venueHoldingOrder = venueHoldingOrder; + } + + + public StrategyOrderPlaceOrdersInner comissionCharged(Integer comissionCharged) { + + + + + this.comissionCharged = comissionCharged; + return this; + } + + /** + * Get comissionCharged + * @return comissionCharged + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "0", value = "") + + public Integer getComissionCharged() { + return comissionCharged; + } + + + public void setComissionCharged(Integer comissionCharged) { + + + + this.comissionCharged = comissionCharged; + } + + + public StrategyOrderPlaceOrdersInner exchangeOrderId(String exchangeOrderId) { + + + + + this.exchangeOrderId = exchangeOrderId; + return this; + } + + /** + * Get exchangeOrderId + * @return exchangeOrderId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "None", value = "") + + public String getExchangeOrderId() { + return exchangeOrderId; + } + + + public void setExchangeOrderId(String exchangeOrderId) { + + + + this.exchangeOrderId = exchangeOrderId; + } + + + public StrategyOrderPlaceOrdersInner isSignificantShareHolder(Boolean isSignificantShareHolder) { + + + + + this.isSignificantShareHolder = isSignificantShareHolder; + return this; + } + + /** + * Get isSignificantShareHolder + * @return isSignificantShareHolder + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Boolean getIsSignificantShareHolder() { + return isSignificantShareHolder; + } + + + public void setIsSignificantShareHolder(Boolean isSignificantShareHolder) { + + + + this.isSignificantShareHolder = isSignificantShareHolder; + } + + + public StrategyOrderPlaceOrdersInner isInsider(Boolean isInsider) { + + + + + this.isInsider = isInsider; + return this; + } + + /** + * Get isInsider + * @return isInsider + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Boolean getIsInsider() { + return isInsider; + } + + + public void setIsInsider(Boolean isInsider) { + + + + this.isInsider = isInsider; + } + + + public StrategyOrderPlaceOrdersInner isLimitOffsetInDollar(Boolean isLimitOffsetInDollar) { + + + + + this.isLimitOffsetInDollar = isLimitOffsetInDollar; + return this; + } + + /** + * Get isLimitOffsetInDollar + * @return isLimitOffsetInDollar + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Boolean getIsLimitOffsetInDollar() { + return isLimitOffsetInDollar; + } + + + public void setIsLimitOffsetInDollar(Boolean isLimitOffsetInDollar) { + + + + this.isLimitOffsetInDollar = isLimitOffsetInDollar; + } + + + public StrategyOrderPlaceOrdersInner userId(Integer userId) { + + + + + this.userId = userId; + return this; + } + + /** + * Get userId + * @return userId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "514603", value = "") + + public Integer getUserId() { + return userId; + } + + + public void setUserId(Integer userId) { + + + + this.userId = userId; + } + + + public StrategyOrderPlaceOrdersInner placementCommission(String placementCommission) { + + + + + this.placementCommission = placementCommission; + return this; + } + + /** + * Get placementCommission + * @return placementCommission + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public String getPlacementCommission() { + return placementCommission; + } + + + public void setPlacementCommission(String placementCommission) { + + + + this.placementCommission = placementCommission; + } + + + public StrategyOrderPlaceOrdersInner legs(List legs) { + + + + + this.legs = legs; + return this; + } + + public StrategyOrderPlaceOrdersInner addLegsItem(StrategyOrderPlaceOrdersInnerLegsInner legsItem) { + if (this.legs == null) { + this.legs = new ArrayList<>(); + } + this.legs.add(legsItem); + return this; + } + + /** + * Get legs + * @return legs + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public List getLegs() { + return legs; + } + + + public void setLegs(List legs) { + + + + this.legs = legs; + } + + + public StrategyOrderPlaceOrdersInner strategyType(String strategyType) { + + + + + this.strategyType = strategyType; + return this; + } + + /** + * Get strategyType + * @return strategyType + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Strangle", value = "") + + public String getStrategyType() { + return strategyType; + } + + + public void setStrategyType(String strategyType) { + + + + this.strategyType = strategyType; + } + + + public StrategyOrderPlaceOrdersInner triggerStopPrice(String triggerStopPrice) { + + + + + this.triggerStopPrice = triggerStopPrice; + return this; + } + + /** + * Get triggerStopPrice + * @return triggerStopPrice + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public String getTriggerStopPrice() { + return triggerStopPrice; + } + + + public void setTriggerStopPrice(String triggerStopPrice) { + + + + this.triggerStopPrice = triggerStopPrice; + } + + + public StrategyOrderPlaceOrdersInner orderGroupId(Integer orderGroupId) { + + + + + this.orderGroupId = orderGroupId; + return this; + } + + /** + * Get orderGroupId + * @return orderGroupId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "0", value = "") + + public Integer getOrderGroupId() { + return orderGroupId; + } + + + public void setOrderGroupId(Integer orderGroupId) { + + + + this.orderGroupId = orderGroupId; + } + + + public StrategyOrderPlaceOrdersInner orderClass(String orderClass) { + + + + + this.orderClass = orderClass; + return this; + } + + /** + * Get orderClass + * @return orderClass + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public String getOrderClass() { + return orderClass; + } + + + public void setOrderClass(String orderClass) { + + + + this.orderClass = orderClass; + } + + + public StrategyOrderPlaceOrdersInner isCrossZero(Boolean isCrossZero) { + + + + + this.isCrossZero = isCrossZero; + return this; + } + + /** + * Get isCrossZero + * @return isCrossZero + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Boolean getIsCrossZero() { + return isCrossZero; + } + + + public void setIsCrossZero(Boolean isCrossZero) { + + + + this.isCrossZero = isCrossZero; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the StrategyOrderPlaceOrdersInner instance itself + */ + public StrategyOrderPlaceOrdersInner putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StrategyOrderPlaceOrdersInner strategyOrderPlaceOrdersInner = (StrategyOrderPlaceOrdersInner) o; + return Objects.equals(this.id, strategyOrderPlaceOrdersInner.id) && + Objects.equals(this.symbol, strategyOrderPlaceOrdersInner.symbol) && + Objects.equals(this.symbolId, strategyOrderPlaceOrdersInner.symbolId) && + Objects.equals(this.totalQuantity, strategyOrderPlaceOrdersInner.totalQuantity) && + Objects.equals(this.openQuantity, strategyOrderPlaceOrdersInner.openQuantity) && + Objects.equals(this.filledQuantity, strategyOrderPlaceOrdersInner.filledQuantity) && + Objects.equals(this.canceledQuantity, strategyOrderPlaceOrdersInner.canceledQuantity) && + Objects.equals(this.side, strategyOrderPlaceOrdersInner.side) && + Objects.equals(this.orderType, strategyOrderPlaceOrdersInner.orderType) && + Objects.equals(this.limitPrice, strategyOrderPlaceOrdersInner.limitPrice) && + Objects.equals(this.stopPrice, strategyOrderPlaceOrdersInner.stopPrice) && + Objects.equals(this.isAllOrNone, strategyOrderPlaceOrdersInner.isAllOrNone) && + Objects.equals(this.isAnonymous, strategyOrderPlaceOrdersInner.isAnonymous) && + Objects.equals(this.icebergQuantity, strategyOrderPlaceOrdersInner.icebergQuantity) && + Objects.equals(this.minQuantity, strategyOrderPlaceOrdersInner.minQuantity) && + Objects.equals(this.avgExecPrice, strategyOrderPlaceOrdersInner.avgExecPrice) && + Objects.equals(this.lastExecPrice, strategyOrderPlaceOrdersInner.lastExecPrice) && + Objects.equals(this.source, strategyOrderPlaceOrdersInner.source) && + Objects.equals(this.timeInForce, strategyOrderPlaceOrdersInner.timeInForce) && + Objects.equals(this.gtdDate, strategyOrderPlaceOrdersInner.gtdDate) && + Objects.equals(this.state, strategyOrderPlaceOrdersInner.state) && + Objects.equals(this.rejectionReason, strategyOrderPlaceOrdersInner.rejectionReason) && + Objects.equals(this.chainId, strategyOrderPlaceOrdersInner.chainId) && + Objects.equals(this.creationTime, strategyOrderPlaceOrdersInner.creationTime) && + Objects.equals(this.updateTime, strategyOrderPlaceOrdersInner.updateTime) && + Objects.equals(this.notes, strategyOrderPlaceOrdersInner.notes) && + Objects.equals(this.primaryRoute, strategyOrderPlaceOrdersInner.primaryRoute) && + Objects.equals(this.secondaryRoute, strategyOrderPlaceOrdersInner.secondaryRoute) && + Objects.equals(this.orderRoute, strategyOrderPlaceOrdersInner.orderRoute) && + Objects.equals(this.venueHoldingOrder, strategyOrderPlaceOrdersInner.venueHoldingOrder) && + Objects.equals(this.comissionCharged, strategyOrderPlaceOrdersInner.comissionCharged) && + Objects.equals(this.exchangeOrderId, strategyOrderPlaceOrdersInner.exchangeOrderId) && + Objects.equals(this.isSignificantShareHolder, strategyOrderPlaceOrdersInner.isSignificantShareHolder) && + Objects.equals(this.isInsider, strategyOrderPlaceOrdersInner.isInsider) && + Objects.equals(this.isLimitOffsetInDollar, strategyOrderPlaceOrdersInner.isLimitOffsetInDollar) && + Objects.equals(this.userId, strategyOrderPlaceOrdersInner.userId) && + Objects.equals(this.placementCommission, strategyOrderPlaceOrdersInner.placementCommission) && + Objects.equals(this.legs, strategyOrderPlaceOrdersInner.legs) && + Objects.equals(this.strategyType, strategyOrderPlaceOrdersInner.strategyType) && + Objects.equals(this.triggerStopPrice, strategyOrderPlaceOrdersInner.triggerStopPrice) && + Objects.equals(this.orderGroupId, strategyOrderPlaceOrdersInner.orderGroupId) && + Objects.equals(this.orderClass, strategyOrderPlaceOrdersInner.orderClass) && + Objects.equals(this.isCrossZero, strategyOrderPlaceOrdersInner.isCrossZero)&& + Objects.equals(this.additionalProperties, strategyOrderPlaceOrdersInner.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, symbol, symbolId, totalQuantity, openQuantity, filledQuantity, canceledQuantity, side, orderType, limitPrice, stopPrice, isAllOrNone, isAnonymous, icebergQuantity, minQuantity, avgExecPrice, lastExecPrice, source, timeInForce, gtdDate, state, rejectionReason, chainId, creationTime, updateTime, notes, primaryRoute, secondaryRoute, orderRoute, venueHoldingOrder, comissionCharged, exchangeOrderId, isSignificantShareHolder, isInsider, isLimitOffsetInDollar, userId, placementCommission, legs, strategyType, triggerStopPrice, orderGroupId, orderClass, isCrossZero, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StrategyOrderPlaceOrdersInner {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" symbolId: ").append(toIndentedString(symbolId)).append("\n"); + sb.append(" totalQuantity: ").append(toIndentedString(totalQuantity)).append("\n"); + sb.append(" openQuantity: ").append(toIndentedString(openQuantity)).append("\n"); + sb.append(" filledQuantity: ").append(toIndentedString(filledQuantity)).append("\n"); + sb.append(" canceledQuantity: ").append(toIndentedString(canceledQuantity)).append("\n"); + sb.append(" side: ").append(toIndentedString(side)).append("\n"); + sb.append(" orderType: ").append(toIndentedString(orderType)).append("\n"); + sb.append(" limitPrice: ").append(toIndentedString(limitPrice)).append("\n"); + sb.append(" stopPrice: ").append(toIndentedString(stopPrice)).append("\n"); + sb.append(" isAllOrNone: ").append(toIndentedString(isAllOrNone)).append("\n"); + sb.append(" isAnonymous: ").append(toIndentedString(isAnonymous)).append("\n"); + sb.append(" icebergQuantity: ").append(toIndentedString(icebergQuantity)).append("\n"); + sb.append(" minQuantity: ").append(toIndentedString(minQuantity)).append("\n"); + sb.append(" avgExecPrice: ").append(toIndentedString(avgExecPrice)).append("\n"); + sb.append(" lastExecPrice: ").append(toIndentedString(lastExecPrice)).append("\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append(" timeInForce: ").append(toIndentedString(timeInForce)).append("\n"); + sb.append(" gtdDate: ").append(toIndentedString(gtdDate)).append("\n"); + sb.append(" state: ").append(toIndentedString(state)).append("\n"); + sb.append(" rejectionReason: ").append(toIndentedString(rejectionReason)).append("\n"); + sb.append(" chainId: ").append(toIndentedString(chainId)).append("\n"); + sb.append(" creationTime: ").append(toIndentedString(creationTime)).append("\n"); + sb.append(" updateTime: ").append(toIndentedString(updateTime)).append("\n"); + sb.append(" notes: ").append(toIndentedString(notes)).append("\n"); + sb.append(" primaryRoute: ").append(toIndentedString(primaryRoute)).append("\n"); + sb.append(" secondaryRoute: ").append(toIndentedString(secondaryRoute)).append("\n"); + sb.append(" orderRoute: ").append(toIndentedString(orderRoute)).append("\n"); + sb.append(" venueHoldingOrder: ").append(toIndentedString(venueHoldingOrder)).append("\n"); + sb.append(" comissionCharged: ").append(toIndentedString(comissionCharged)).append("\n"); + sb.append(" exchangeOrderId: ").append(toIndentedString(exchangeOrderId)).append("\n"); + sb.append(" isSignificantShareHolder: ").append(toIndentedString(isSignificantShareHolder)).append("\n"); + sb.append(" isInsider: ").append(toIndentedString(isInsider)).append("\n"); + sb.append(" isLimitOffsetInDollar: ").append(toIndentedString(isLimitOffsetInDollar)).append("\n"); + sb.append(" userId: ").append(toIndentedString(userId)).append("\n"); + sb.append(" placementCommission: ").append(toIndentedString(placementCommission)).append("\n"); + sb.append(" legs: ").append(toIndentedString(legs)).append("\n"); + sb.append(" strategyType: ").append(toIndentedString(strategyType)).append("\n"); + sb.append(" triggerStopPrice: ").append(toIndentedString(triggerStopPrice)).append("\n"); + sb.append(" orderGroupId: ").append(toIndentedString(orderGroupId)).append("\n"); + sb.append(" orderClass: ").append(toIndentedString(orderClass)).append("\n"); + sb.append(" isCrossZero: ").append(toIndentedString(isCrossZero)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("symbol"); + openapiFields.add("symbolId"); + openapiFields.add("totalQuantity"); + openapiFields.add("openQuantity"); + openapiFields.add("filledQuantity"); + openapiFields.add("canceledQuantity"); + openapiFields.add("side"); + openapiFields.add("orderType"); + openapiFields.add("limitPrice"); + openapiFields.add("stopPrice"); + openapiFields.add("isAllOrNone"); + openapiFields.add("isAnonymous"); + openapiFields.add("icebergQuantity"); + openapiFields.add("minQuantity"); + openapiFields.add("avgExecPrice"); + openapiFields.add("lastExecPrice"); + openapiFields.add("source"); + openapiFields.add("timeInForce"); + openapiFields.add("gtdDate"); + openapiFields.add("state"); + openapiFields.add("rejectionReason"); + openapiFields.add("chainId"); + openapiFields.add("creationTime"); + openapiFields.add("updateTime"); + openapiFields.add("notes"); + openapiFields.add("primaryRoute"); + openapiFields.add("secondaryRoute"); + openapiFields.add("orderRoute"); + openapiFields.add("venueHoldingOrder"); + openapiFields.add("comissionCharged"); + openapiFields.add("exchangeOrderId"); + openapiFields.add("isSignificantShareHolder"); + openapiFields.add("isInsider"); + openapiFields.add("isLimitOffsetInDollar"); + openapiFields.add("userId"); + openapiFields.add("placementCommission"); + openapiFields.add("legs"); + openapiFields.add("strategyType"); + openapiFields.add("triggerStopPrice"); + openapiFields.add("orderGroupId"); + openapiFields.add("orderClass"); + openapiFields.add("isCrossZero"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to StrategyOrderPlaceOrdersInner + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!StrategyOrderPlaceOrdersInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StrategyOrderPlaceOrdersInner is not found in the empty JSON string", StrategyOrderPlaceOrdersInner.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("symbol") != null && !jsonObj.get("symbol").isJsonNull()) && !jsonObj.get("symbol").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `symbol` to be a primitive type in the JSON string but got `%s`", jsonObj.get("symbol").toString())); + } + if ((jsonObj.get("side") != null && !jsonObj.get("side").isJsonNull()) && !jsonObj.get("side").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `side` to be a primitive type in the JSON string but got `%s`", jsonObj.get("side").toString())); + } + if ((jsonObj.get("orderType") != null && !jsonObj.get("orderType").isJsonNull()) && !jsonObj.get("orderType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `orderType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("orderType").toString())); + } + if ((jsonObj.get("limitPrice") != null && !jsonObj.get("limitPrice").isJsonNull()) && !jsonObj.get("limitPrice").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `limitPrice` to be a primitive type in the JSON string but got `%s`", jsonObj.get("limitPrice").toString())); + } + if ((jsonObj.get("stopPrice") != null && !jsonObj.get("stopPrice").isJsonNull()) && !jsonObj.get("stopPrice").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `stopPrice` to be a primitive type in the JSON string but got `%s`", jsonObj.get("stopPrice").toString())); + } + if ((jsonObj.get("icebergQuantity") != null && !jsonObj.get("icebergQuantity").isJsonNull()) && !jsonObj.get("icebergQuantity").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `icebergQuantity` to be a primitive type in the JSON string but got `%s`", jsonObj.get("icebergQuantity").toString())); + } + if ((jsonObj.get("minQuantity") != null && !jsonObj.get("minQuantity").isJsonNull()) && !jsonObj.get("minQuantity").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `minQuantity` to be a primitive type in the JSON string but got `%s`", jsonObj.get("minQuantity").toString())); + } + if ((jsonObj.get("lastExecPrice") != null && !jsonObj.get("lastExecPrice").isJsonNull()) && !jsonObj.get("lastExecPrice").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lastExecPrice` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastExecPrice").toString())); + } + if ((jsonObj.get("source") != null && !jsonObj.get("source").isJsonNull()) && !jsonObj.get("source").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `source` to be a primitive type in the JSON string but got `%s`", jsonObj.get("source").toString())); + } + if ((jsonObj.get("timeInForce") != null && !jsonObj.get("timeInForce").isJsonNull()) && !jsonObj.get("timeInForce").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `timeInForce` to be a primitive type in the JSON string but got `%s`", jsonObj.get("timeInForce").toString())); + } + if ((jsonObj.get("gtdDate") != null && !jsonObj.get("gtdDate").isJsonNull()) && !jsonObj.get("gtdDate").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `gtdDate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("gtdDate").toString())); + } + if ((jsonObj.get("state") != null && !jsonObj.get("state").isJsonNull()) && !jsonObj.get("state").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `state` to be a primitive type in the JSON string but got `%s`", jsonObj.get("state").toString())); + } + if ((jsonObj.get("rejectionReason") != null && !jsonObj.get("rejectionReason").isJsonNull()) && !jsonObj.get("rejectionReason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `rejectionReason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("rejectionReason").toString())); + } + if ((jsonObj.get("creationTime") != null && !jsonObj.get("creationTime").isJsonNull()) && !jsonObj.get("creationTime").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `creationTime` to be a primitive type in the JSON string but got `%s`", jsonObj.get("creationTime").toString())); + } + if ((jsonObj.get("updateTime") != null && !jsonObj.get("updateTime").isJsonNull()) && !jsonObj.get("updateTime").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `updateTime` to be a primitive type in the JSON string but got `%s`", jsonObj.get("updateTime").toString())); + } + if ((jsonObj.get("notes") != null && !jsonObj.get("notes").isJsonNull()) && !jsonObj.get("notes").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `notes` to be a primitive type in the JSON string but got `%s`", jsonObj.get("notes").toString())); + } + if ((jsonObj.get("primaryRoute") != null && !jsonObj.get("primaryRoute").isJsonNull()) && !jsonObj.get("primaryRoute").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `primaryRoute` to be a primitive type in the JSON string but got `%s`", jsonObj.get("primaryRoute").toString())); + } + if ((jsonObj.get("secondaryRoute") != null && !jsonObj.get("secondaryRoute").isJsonNull()) && !jsonObj.get("secondaryRoute").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `secondaryRoute` to be a primitive type in the JSON string but got `%s`", jsonObj.get("secondaryRoute").toString())); + } + if ((jsonObj.get("orderRoute") != null && !jsonObj.get("orderRoute").isJsonNull()) && !jsonObj.get("orderRoute").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `orderRoute` to be a primitive type in the JSON string but got `%s`", jsonObj.get("orderRoute").toString())); + } + if ((jsonObj.get("venueHoldingOrder") != null && !jsonObj.get("venueHoldingOrder").isJsonNull()) && !jsonObj.get("venueHoldingOrder").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `venueHoldingOrder` to be a primitive type in the JSON string but got `%s`", jsonObj.get("venueHoldingOrder").toString())); + } + if ((jsonObj.get("exchangeOrderId") != null && !jsonObj.get("exchangeOrderId").isJsonNull()) && !jsonObj.get("exchangeOrderId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `exchangeOrderId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("exchangeOrderId").toString())); + } + if ((jsonObj.get("placementCommission") != null && !jsonObj.get("placementCommission").isJsonNull()) && !jsonObj.get("placementCommission").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `placementCommission` to be a primitive type in the JSON string but got `%s`", jsonObj.get("placementCommission").toString())); + } + if (jsonObj.get("legs") != null && !jsonObj.get("legs").isJsonNull()) { + JsonArray jsonArraylegs = jsonObj.getAsJsonArray("legs"); + if (jsonArraylegs != null) { + // ensure the json data is an array + if (!jsonObj.get("legs").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `legs` to be an array in the JSON string but got `%s`", jsonObj.get("legs").toString())); + } + + // validate the optional field `legs` (array) + for (int i = 0; i < jsonArraylegs.size(); i++) { + StrategyOrderPlaceOrdersInnerLegsInner.validateJsonObject(jsonArraylegs.get(i).getAsJsonObject()); + }; + } + } + if ((jsonObj.get("strategyType") != null && !jsonObj.get("strategyType").isJsonNull()) && !jsonObj.get("strategyType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `strategyType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("strategyType").toString())); + } + if ((jsonObj.get("triggerStopPrice") != null && !jsonObj.get("triggerStopPrice").isJsonNull()) && !jsonObj.get("triggerStopPrice").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `triggerStopPrice` to be a primitive type in the JSON string but got `%s`", jsonObj.get("triggerStopPrice").toString())); + } + if ((jsonObj.get("orderClass") != null && !jsonObj.get("orderClass").isJsonNull()) && !jsonObj.get("orderClass").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `orderClass` to be a primitive type in the JSON string but got `%s`", jsonObj.get("orderClass").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StrategyOrderPlaceOrdersInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StrategyOrderPlaceOrdersInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StrategyOrderPlaceOrdersInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StrategyOrderPlaceOrdersInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public StrategyOrderPlaceOrdersInner read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + StrategyOrderPlaceOrdersInner instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StrategyOrderPlaceOrdersInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of StrategyOrderPlaceOrdersInner + * @throws IOException if the JSON string is invalid with respect to StrategyOrderPlaceOrdersInner + */ + public static StrategyOrderPlaceOrdersInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StrategyOrderPlaceOrdersInner.class); + } + + /** + * Convert an instance of StrategyOrderPlaceOrdersInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/StrategyOrderPlaceOrdersInnerLegsInner.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/StrategyOrderPlaceOrdersInnerLegsInner.java new file mode 100644 index 0000000000..ce7f1f3ff1 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/StrategyOrderPlaceOrdersInnerLegsInner.java @@ -0,0 +1,512 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * StrategyOrderPlaceOrdersInnerLegsInner + */@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class StrategyOrderPlaceOrdersInnerLegsInner { + public static final String SERIALIZED_NAME_LEG_ID = "legId"; + @SerializedName(SERIALIZED_NAME_LEG_ID) + private Integer legId; + + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + @SerializedName(SERIALIZED_NAME_SYMBOL) + private String symbol; + + public static final String SERIALIZED_NAME_SYMBOL_ID = "symbolId"; + @SerializedName(SERIALIZED_NAME_SYMBOL_ID) + private Integer symbolId; + + public static final String SERIALIZED_NAME_LEG_RATIO_QUANTITY = "legRatioQuantity"; + @SerializedName(SERIALIZED_NAME_LEG_RATIO_QUANTITY) + private Integer legRatioQuantity; + + public static final String SERIALIZED_NAME_SIDE = "side"; + @SerializedName(SERIALIZED_NAME_SIDE) + private String side; + + public static final String SERIALIZED_NAME_AVG_EXEC_PRICE = "avgExecPrice"; + @SerializedName(SERIALIZED_NAME_AVG_EXEC_PRICE) + private Integer avgExecPrice; + + public static final String SERIALIZED_NAME_LAST_EXEC_PRICE = "lastExecPrice"; + @SerializedName(SERIALIZED_NAME_LAST_EXEC_PRICE) + private String lastExecPrice; + + public StrategyOrderPlaceOrdersInnerLegsInner() { + } + + public StrategyOrderPlaceOrdersInnerLegsInner legId(Integer legId) { + + + + + this.legId = legId; + return this; + } + + /** + * Get legId + * @return legId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "0", value = "") + + public Integer getLegId() { + return legId; + } + + + public void setLegId(Integer legId) { + + + + this.legId = legId; + } + + + public StrategyOrderPlaceOrdersInnerLegsInner symbol(String symbol) { + + + + + this.symbol = symbol; + return this; + } + + /** + * Get symbol + * @return symbol + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "AC21Oct22C30.00.MX", value = "") + + public String getSymbol() { + return symbol; + } + + + public void setSymbol(String symbol) { + + + + this.symbol = symbol; + } + + + public StrategyOrderPlaceOrdersInnerLegsInner symbolId(Integer symbolId) { + + + + + this.symbolId = symbolId; + return this; + } + + /** + * Get symbolId + * @return symbolId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "41790511", value = "") + + public Integer getSymbolId() { + return symbolId; + } + + + public void setSymbolId(Integer symbolId) { + + + + this.symbolId = symbolId; + } + + + public StrategyOrderPlaceOrdersInnerLegsInner legRatioQuantity(Integer legRatioQuantity) { + + + + + this.legRatioQuantity = legRatioQuantity; + return this; + } + + /** + * Get legRatioQuantity + * @return legRatioQuantity + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "1", value = "") + + public Integer getLegRatioQuantity() { + return legRatioQuantity; + } + + + public void setLegRatioQuantity(Integer legRatioQuantity) { + + + + this.legRatioQuantity = legRatioQuantity; + } + + + public StrategyOrderPlaceOrdersInnerLegsInner side(String side) { + + + + + this.side = side; + return this; + } + + /** + * Get side + * @return side + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "BTO", value = "") + + public String getSide() { + return side; + } + + + public void setSide(String side) { + + + + this.side = side; + } + + + public StrategyOrderPlaceOrdersInnerLegsInner avgExecPrice(Integer avgExecPrice) { + + + + + this.avgExecPrice = avgExecPrice; + return this; + } + + /** + * Get avgExecPrice + * @return avgExecPrice + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "0", value = "") + + public Integer getAvgExecPrice() { + return avgExecPrice; + } + + + public void setAvgExecPrice(Integer avgExecPrice) { + + + + this.avgExecPrice = avgExecPrice; + } + + + public StrategyOrderPlaceOrdersInnerLegsInner lastExecPrice(String lastExecPrice) { + + + + + this.lastExecPrice = lastExecPrice; + return this; + } + + /** + * Get lastExecPrice + * @return lastExecPrice + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public String getLastExecPrice() { + return lastExecPrice; + } + + + public void setLastExecPrice(String lastExecPrice) { + + + + this.lastExecPrice = lastExecPrice; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the StrategyOrderPlaceOrdersInnerLegsInner instance itself + */ + public StrategyOrderPlaceOrdersInnerLegsInner putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StrategyOrderPlaceOrdersInnerLegsInner strategyOrderPlaceOrdersInnerLegsInner = (StrategyOrderPlaceOrdersInnerLegsInner) o; + return Objects.equals(this.legId, strategyOrderPlaceOrdersInnerLegsInner.legId) && + Objects.equals(this.symbol, strategyOrderPlaceOrdersInnerLegsInner.symbol) && + Objects.equals(this.symbolId, strategyOrderPlaceOrdersInnerLegsInner.symbolId) && + Objects.equals(this.legRatioQuantity, strategyOrderPlaceOrdersInnerLegsInner.legRatioQuantity) && + Objects.equals(this.side, strategyOrderPlaceOrdersInnerLegsInner.side) && + Objects.equals(this.avgExecPrice, strategyOrderPlaceOrdersInnerLegsInner.avgExecPrice) && + Objects.equals(this.lastExecPrice, strategyOrderPlaceOrdersInnerLegsInner.lastExecPrice)&& + Objects.equals(this.additionalProperties, strategyOrderPlaceOrdersInnerLegsInner.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(legId, symbol, symbolId, legRatioQuantity, side, avgExecPrice, lastExecPrice, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StrategyOrderPlaceOrdersInnerLegsInner {\n"); + sb.append(" legId: ").append(toIndentedString(legId)).append("\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" symbolId: ").append(toIndentedString(symbolId)).append("\n"); + sb.append(" legRatioQuantity: ").append(toIndentedString(legRatioQuantity)).append("\n"); + sb.append(" side: ").append(toIndentedString(side)).append("\n"); + sb.append(" avgExecPrice: ").append(toIndentedString(avgExecPrice)).append("\n"); + sb.append(" lastExecPrice: ").append(toIndentedString(lastExecPrice)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("legId"); + openapiFields.add("symbol"); + openapiFields.add("symbolId"); + openapiFields.add("legRatioQuantity"); + openapiFields.add("side"); + openapiFields.add("avgExecPrice"); + openapiFields.add("lastExecPrice"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to StrategyOrderPlaceOrdersInnerLegsInner + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!StrategyOrderPlaceOrdersInnerLegsInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StrategyOrderPlaceOrdersInnerLegsInner is not found in the empty JSON string", StrategyOrderPlaceOrdersInnerLegsInner.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("symbol") != null && !jsonObj.get("symbol").isJsonNull()) && !jsonObj.get("symbol").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `symbol` to be a primitive type in the JSON string but got `%s`", jsonObj.get("symbol").toString())); + } + if ((jsonObj.get("side") != null && !jsonObj.get("side").isJsonNull()) && !jsonObj.get("side").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `side` to be a primitive type in the JSON string but got `%s`", jsonObj.get("side").toString())); + } + if ((jsonObj.get("lastExecPrice") != null && !jsonObj.get("lastExecPrice").isJsonNull()) && !jsonObj.get("lastExecPrice").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lastExecPrice` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastExecPrice").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StrategyOrderPlaceOrdersInnerLegsInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StrategyOrderPlaceOrdersInnerLegsInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StrategyOrderPlaceOrdersInnerLegsInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StrategyOrderPlaceOrdersInnerLegsInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public StrategyOrderPlaceOrdersInnerLegsInner read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + StrategyOrderPlaceOrdersInnerLegsInner instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StrategyOrderPlaceOrdersInnerLegsInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of StrategyOrderPlaceOrdersInnerLegsInner + * @throws IOException if the JSON string is invalid with respect to StrategyOrderPlaceOrdersInnerLegsInner + */ + public static StrategyOrderPlaceOrdersInnerLegsInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StrategyOrderPlaceOrdersInnerLegsInner.class); + } + + /** + * Convert an instance of StrategyOrderPlaceOrdersInnerLegsInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/StrategyOrderRecord.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/StrategyOrderRecord.java new file mode 100644 index 0000000000..e9987945c6 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/StrategyOrderRecord.java @@ -0,0 +1,806 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.OptionStrategy; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Strategy order record + */ +@ApiModel(description = "Strategy order record")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class StrategyOrderRecord { + public static final String SERIALIZED_NAME_STRATEGY = "strategy"; + @SerializedName(SERIALIZED_NAME_STRATEGY) + private OptionStrategy strategy; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + PENDING("PENDING"), + + ACCEPTED("ACCEPTED"), + + FAILED("FAILED"), + + REJECTED("REJECTED"), + + CANCELED("CANCELED"), + + PARTIAL_CANCELED("PARTIAL_CANCELED"), + + CANCEL_PENDING("CANCEL_PENDING"), + + EXECUTED("EXECUTED"), + + PARTIAL("PARTIAL"), + + REPLACE_PENDING("REPLACE_PENDING"), + + REPLACED("REPLACED"), + + STOPPED("STOPPED"), + + SUSPENDED("SUSPENDED"), + + EXPIRED("EXPIRED"), + + QUEUED("QUEUED"), + + TRIGGERED("TRIGGERED"), + + ACTIVATED("ACTIVATED"), + + PENDING_RISK_REVIEW("PENDING_RISK_REVIEW"), + + CONTINGENT_ORDER("CONTINGENT_ORDER"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; + + public static final String SERIALIZED_NAME_FILLED_QUANTITY = "filled_quantity"; + @SerializedName(SERIALIZED_NAME_FILLED_QUANTITY) + private Double filledQuantity; + + public static final String SERIALIZED_NAME_OPEN_QUANTITY = "open_quantity"; + @SerializedName(SERIALIZED_NAME_OPEN_QUANTITY) + private Double openQuantity; + + public static final String SERIALIZED_NAME_CLOSED_QUANTITY = "closed_quantity"; + @SerializedName(SERIALIZED_NAME_CLOSED_QUANTITY) + private Double closedQuantity; + + public static final String SERIALIZED_NAME_ORDER_TYPE = "order_type"; + @SerializedName(SERIALIZED_NAME_ORDER_TYPE) + private String orderType; + + public static final String SERIALIZED_NAME_TIME_IN_FORCE = "time_in_force"; + @SerializedName(SERIALIZED_NAME_TIME_IN_FORCE) + private String timeInForce; + + public static final String SERIALIZED_NAME_LIMIT_PRICE = "limit_price"; + @SerializedName(SERIALIZED_NAME_LIMIT_PRICE) + private Double limitPrice; + + public static final String SERIALIZED_NAME_EXECUTION_PRICE = "execution_price"; + @SerializedName(SERIALIZED_NAME_EXECUTION_PRICE) + private Double executionPrice; + + public static final String SERIALIZED_NAME_TIME_PLACED = "time_placed"; + @SerializedName(SERIALIZED_NAME_TIME_PLACED) + private String timePlaced; + + public static final String SERIALIZED_NAME_TIME_UPDATED = "time_updated"; + @SerializedName(SERIALIZED_NAME_TIME_UPDATED) + private String timeUpdated; + + public StrategyOrderRecord() { + } + + public StrategyOrderRecord strategy(OptionStrategy strategy) { + + + + + this.strategy = strategy; + return this; + } + + /** + * Get strategy + * @return strategy + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public OptionStrategy getStrategy() { + return strategy; + } + + + public void setStrategy(OptionStrategy strategy) { + + + + this.strategy = strategy; + } + + + public StrategyOrderRecord status(StatusEnum status) { + + + + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public StatusEnum getStatus() { + return status; + } + + + public void setStatus(StatusEnum status) { + + + + this.status = status; + } + + + public StrategyOrderRecord filledQuantity(Double filledQuantity) { + + + + + this.filledQuantity = filledQuantity; + return this; + } + + public StrategyOrderRecord filledQuantity(Integer filledQuantity) { + + + + + this.filledQuantity = filledQuantity.doubleValue(); + return this; + } + + /** + * Get filledQuantity + * @return filledQuantity + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "10", value = "") + + public Double getFilledQuantity() { + return filledQuantity; + } + + + public void setFilledQuantity(Double filledQuantity) { + + + + this.filledQuantity = filledQuantity; + } + + + public StrategyOrderRecord openQuantity(Double openQuantity) { + + + + + this.openQuantity = openQuantity; + return this; + } + + public StrategyOrderRecord openQuantity(Integer openQuantity) { + + + + + this.openQuantity = openQuantity.doubleValue(); + return this; + } + + /** + * Get openQuantity + * @return openQuantity + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "10", value = "") + + public Double getOpenQuantity() { + return openQuantity; + } + + + public void setOpenQuantity(Double openQuantity) { + + + + this.openQuantity = openQuantity; + } + + + public StrategyOrderRecord closedQuantity(Double closedQuantity) { + + + + + this.closedQuantity = closedQuantity; + return this; + } + + public StrategyOrderRecord closedQuantity(Integer closedQuantity) { + + + + + this.closedQuantity = closedQuantity.doubleValue(); + return this; + } + + /** + * Get closedQuantity + * @return closedQuantity + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "10", value = "") + + public Double getClosedQuantity() { + return closedQuantity; + } + + + public void setClosedQuantity(Double closedQuantity) { + + + + this.closedQuantity = closedQuantity; + } + + + public StrategyOrderRecord orderType(String orderType) { + + + + + this.orderType = orderType; + return this; + } + + /** + * Order Type potential values include (but are not limited to) - Limit - Market - StopLimit - StopLoss + * @return orderType + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Order Type potential values include (but are not limited to) - Limit - Market - StopLimit - StopLoss") + + public String getOrderType() { + return orderType; + } + + + public void setOrderType(String orderType) { + + + + this.orderType = orderType; + } + + + public StrategyOrderRecord timeInForce(String timeInForce) { + + + + + this.timeInForce = timeInForce; + return this; + } + + /** + * Trade time in force examples: * FOK - Fill Or Kill * Day - Day * GTC - Good Til Canceled * GTD - Good Til Date + * @return timeInForce + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Trade time in force examples: * FOK - Fill Or Kill * Day - Day * GTC - Good Til Canceled * GTD - Good Til Date ") + + public String getTimeInForce() { + return timeInForce; + } + + + public void setTimeInForce(String timeInForce) { + + + + this.timeInForce = timeInForce; + } + + + public StrategyOrderRecord limitPrice(Double limitPrice) { + + + + + this.limitPrice = limitPrice; + return this; + } + + public StrategyOrderRecord limitPrice(Integer limitPrice) { + + + + + this.limitPrice = limitPrice.doubleValue(); + return this; + } + + /** + * Trade Price if limit or stop limit order + * @return limitPrice + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "31.33", value = "Trade Price if limit or stop limit order") + + public Double getLimitPrice() { + return limitPrice; + } + + + public void setLimitPrice(Double limitPrice) { + + + + this.limitPrice = limitPrice; + } + + + public StrategyOrderRecord executionPrice(Double executionPrice) { + + + + + this.executionPrice = executionPrice; + return this; + } + + public StrategyOrderRecord executionPrice(Integer executionPrice) { + + + + + this.executionPrice = executionPrice.doubleValue(); + return this; + } + + /** + * Trade Price if limit or stop limit order + * @return executionPrice + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "31.33", value = "Trade Price if limit or stop limit order") + + public Double getExecutionPrice() { + return executionPrice; + } + + + public void setExecutionPrice(Double executionPrice) { + + + + this.executionPrice = executionPrice; + } + + + public StrategyOrderRecord timePlaced(String timePlaced) { + + + + + this.timePlaced = timePlaced; + return this; + } + + /** + * Time + * @return timePlaced + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2022-01-21T20:11:19.217Z", value = "Time") + + public String getTimePlaced() { + return timePlaced; + } + + + public void setTimePlaced(String timePlaced) { + + + + this.timePlaced = timePlaced; + } + + + public StrategyOrderRecord timeUpdated(String timeUpdated) { + + + + + this.timeUpdated = timeUpdated; + return this; + } + + /** + * Time + * @return timeUpdated + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2022-01-21T20:11:19.217Z", value = "Time") + + public String getTimeUpdated() { + return timeUpdated; + } + + + public void setTimeUpdated(String timeUpdated) { + + + + this.timeUpdated = timeUpdated; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the StrategyOrderRecord instance itself + */ + public StrategyOrderRecord putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StrategyOrderRecord strategyOrderRecord = (StrategyOrderRecord) o; + return Objects.equals(this.strategy, strategyOrderRecord.strategy) && + Objects.equals(this.status, strategyOrderRecord.status) && + Objects.equals(this.filledQuantity, strategyOrderRecord.filledQuantity) && + Objects.equals(this.openQuantity, strategyOrderRecord.openQuantity) && + Objects.equals(this.closedQuantity, strategyOrderRecord.closedQuantity) && + Objects.equals(this.orderType, strategyOrderRecord.orderType) && + Objects.equals(this.timeInForce, strategyOrderRecord.timeInForce) && + Objects.equals(this.limitPrice, strategyOrderRecord.limitPrice) && + Objects.equals(this.executionPrice, strategyOrderRecord.executionPrice) && + Objects.equals(this.timePlaced, strategyOrderRecord.timePlaced) && + Objects.equals(this.timeUpdated, strategyOrderRecord.timeUpdated)&& + Objects.equals(this.additionalProperties, strategyOrderRecord.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(strategy, status, filledQuantity, openQuantity, closedQuantity, orderType, timeInForce, limitPrice, executionPrice, timePlaced, timeUpdated, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StrategyOrderRecord {\n"); + sb.append(" strategy: ").append(toIndentedString(strategy)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" filledQuantity: ").append(toIndentedString(filledQuantity)).append("\n"); + sb.append(" openQuantity: ").append(toIndentedString(openQuantity)).append("\n"); + sb.append(" closedQuantity: ").append(toIndentedString(closedQuantity)).append("\n"); + sb.append(" orderType: ").append(toIndentedString(orderType)).append("\n"); + sb.append(" timeInForce: ").append(toIndentedString(timeInForce)).append("\n"); + sb.append(" limitPrice: ").append(toIndentedString(limitPrice)).append("\n"); + sb.append(" executionPrice: ").append(toIndentedString(executionPrice)).append("\n"); + sb.append(" timePlaced: ").append(toIndentedString(timePlaced)).append("\n"); + sb.append(" timeUpdated: ").append(toIndentedString(timeUpdated)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("strategy"); + openapiFields.add("status"); + openapiFields.add("filled_quantity"); + openapiFields.add("open_quantity"); + openapiFields.add("closed_quantity"); + openapiFields.add("order_type"); + openapiFields.add("time_in_force"); + openapiFields.add("limit_price"); + openapiFields.add("execution_price"); + openapiFields.add("time_placed"); + openapiFields.add("time_updated"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to StrategyOrderRecord + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!StrategyOrderRecord.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StrategyOrderRecord is not found in the empty JSON string", StrategyOrderRecord.openapiRequiredFields.toString())); + } + } + // validate the optional field `strategy` + if (jsonObj.get("strategy") != null && !jsonObj.get("strategy").isJsonNull()) { + OptionStrategy.validateJsonObject(jsonObj.getAsJsonObject("strategy")); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if (!jsonObj.get("order_type").isJsonNull() && (jsonObj.get("order_type") != null && !jsonObj.get("order_type").isJsonNull()) && !jsonObj.get("order_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `order_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("order_type").toString())); + } + if ((jsonObj.get("time_in_force") != null && !jsonObj.get("time_in_force").isJsonNull()) && !jsonObj.get("time_in_force").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `time_in_force` to be a primitive type in the JSON string but got `%s`", jsonObj.get("time_in_force").toString())); + } + if ((jsonObj.get("time_placed") != null && !jsonObj.get("time_placed").isJsonNull()) && !jsonObj.get("time_placed").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `time_placed` to be a primitive type in the JSON string but got `%s`", jsonObj.get("time_placed").toString())); + } + if ((jsonObj.get("time_updated") != null && !jsonObj.get("time_updated").isJsonNull()) && !jsonObj.get("time_updated").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `time_updated` to be a primitive type in the JSON string but got `%s`", jsonObj.get("time_updated").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StrategyOrderRecord.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StrategyOrderRecord' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StrategyOrderRecord.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StrategyOrderRecord value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public StrategyOrderRecord read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + StrategyOrderRecord instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StrategyOrderRecord given an JSON string + * + * @param jsonString JSON string + * @return An instance of StrategyOrderRecord + * @throws IOException if the JSON string is invalid with respect to StrategyOrderRecord + */ + public static StrategyOrderRecord fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StrategyOrderRecord.class); + } + + /** + * Convert an instance of StrategyOrderRecord to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/StrategyQuotes.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/StrategyQuotes.java new file mode 100644 index 0000000000..94c4f1a2ca --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/StrategyQuotes.java @@ -0,0 +1,525 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.OptionStrategy; +import com.konfigthis.client.model.StrategyQuotesGreek; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * StrategyQuotes + */@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class StrategyQuotes { + public static final String SERIALIZED_NAME_STRATEGY = "strategy"; + @SerializedName(SERIALIZED_NAME_STRATEGY) + private OptionStrategy strategy; + + public static final String SERIALIZED_NAME_OPEN_PRICE = "open_price"; + @SerializedName(SERIALIZED_NAME_OPEN_PRICE) + private Double openPrice; + + public static final String SERIALIZED_NAME_BID_PRICE = "bid_price"; + @SerializedName(SERIALIZED_NAME_BID_PRICE) + private Double bidPrice; + + public static final String SERIALIZED_NAME_ASK_PRICE = "ask_price"; + @SerializedName(SERIALIZED_NAME_ASK_PRICE) + private Double askPrice; + + public static final String SERIALIZED_NAME_VOLATILITY = "volatility"; + @SerializedName(SERIALIZED_NAME_VOLATILITY) + private Double volatility; + + public static final String SERIALIZED_NAME_GREEK = "greek"; + @SerializedName(SERIALIZED_NAME_GREEK) + private StrategyQuotesGreek greek; + + public StrategyQuotes() { + } + + public StrategyQuotes strategy(OptionStrategy strategy) { + + + + + this.strategy = strategy; + return this; + } + + /** + * Get strategy + * @return strategy + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public OptionStrategy getStrategy() { + return strategy; + } + + + public void setStrategy(OptionStrategy strategy) { + + + + this.strategy = strategy; + } + + + public StrategyQuotes openPrice(Double openPrice) { + + + + + this.openPrice = openPrice; + return this; + } + + public StrategyQuotes openPrice(Integer openPrice) { + + + + + this.openPrice = openPrice.doubleValue(); + return this; + } + + /** + * Trade Price if limit or stop limit order + * @return openPrice + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "31.33", value = "Trade Price if limit or stop limit order") + + public Double getOpenPrice() { + return openPrice; + } + + + public void setOpenPrice(Double openPrice) { + + + + this.openPrice = openPrice; + } + + + public StrategyQuotes bidPrice(Double bidPrice) { + + + + + this.bidPrice = bidPrice; + return this; + } + + public StrategyQuotes bidPrice(Integer bidPrice) { + + + + + this.bidPrice = bidPrice.doubleValue(); + return this; + } + + /** + * Trade Price if limit or stop limit order + * @return bidPrice + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "31.33", value = "Trade Price if limit or stop limit order") + + public Double getBidPrice() { + return bidPrice; + } + + + public void setBidPrice(Double bidPrice) { + + + + this.bidPrice = bidPrice; + } + + + public StrategyQuotes askPrice(Double askPrice) { + + + + + this.askPrice = askPrice; + return this; + } + + public StrategyQuotes askPrice(Integer askPrice) { + + + + + this.askPrice = askPrice.doubleValue(); + return this; + } + + /** + * Trade Price if limit or stop limit order + * @return askPrice + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "31.33", value = "Trade Price if limit or stop limit order") + + public Double getAskPrice() { + return askPrice; + } + + + public void setAskPrice(Double askPrice) { + + + + this.askPrice = askPrice; + } + + + public StrategyQuotes volatility(Double volatility) { + + + + + this.volatility = volatility; + return this; + } + + public StrategyQuotes volatility(Integer volatility) { + + + + + this.volatility = volatility.doubleValue(); + return this; + } + + /** + * Get volatility + * @return volatility + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "0.141", value = "") + + public Double getVolatility() { + return volatility; + } + + + public void setVolatility(Double volatility) { + + + + this.volatility = volatility; + } + + + public StrategyQuotes greek(StrategyQuotesGreek greek) { + + + + + this.greek = greek; + return this; + } + + /** + * Get greek + * @return greek + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public StrategyQuotesGreek getGreek() { + return greek; + } + + + public void setGreek(StrategyQuotesGreek greek) { + + + + this.greek = greek; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the StrategyQuotes instance itself + */ + public StrategyQuotes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StrategyQuotes strategyQuotes = (StrategyQuotes) o; + return Objects.equals(this.strategy, strategyQuotes.strategy) && + Objects.equals(this.openPrice, strategyQuotes.openPrice) && + Objects.equals(this.bidPrice, strategyQuotes.bidPrice) && + Objects.equals(this.askPrice, strategyQuotes.askPrice) && + Objects.equals(this.volatility, strategyQuotes.volatility) && + Objects.equals(this.greek, strategyQuotes.greek)&& + Objects.equals(this.additionalProperties, strategyQuotes.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(strategy, openPrice, bidPrice, askPrice, volatility, greek, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StrategyQuotes {\n"); + sb.append(" strategy: ").append(toIndentedString(strategy)).append("\n"); + sb.append(" openPrice: ").append(toIndentedString(openPrice)).append("\n"); + sb.append(" bidPrice: ").append(toIndentedString(bidPrice)).append("\n"); + sb.append(" askPrice: ").append(toIndentedString(askPrice)).append("\n"); + sb.append(" volatility: ").append(toIndentedString(volatility)).append("\n"); + sb.append(" greek: ").append(toIndentedString(greek)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("strategy"); + openapiFields.add("open_price"); + openapiFields.add("bid_price"); + openapiFields.add("ask_price"); + openapiFields.add("volatility"); + openapiFields.add("greek"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to StrategyQuotes + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!StrategyQuotes.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StrategyQuotes is not found in the empty JSON string", StrategyQuotes.openapiRequiredFields.toString())); + } + } + // validate the optional field `strategy` + if (jsonObj.get("strategy") != null && !jsonObj.get("strategy").isJsonNull()) { + OptionStrategy.validateJsonObject(jsonObj.getAsJsonObject("strategy")); + } + // validate the optional field `greek` + if (jsonObj.get("greek") != null && !jsonObj.get("greek").isJsonNull()) { + StrategyQuotesGreek.validateJsonObject(jsonObj.getAsJsonObject("greek")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StrategyQuotes.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StrategyQuotes' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StrategyQuotes.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StrategyQuotes value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public StrategyQuotes read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + StrategyQuotes instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StrategyQuotes given an JSON string + * + * @param jsonString JSON string + * @return An instance of StrategyQuotes + * @throws IOException if the JSON string is invalid with respect to StrategyQuotes + */ + public static StrategyQuotes fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StrategyQuotes.class); + } + + /** + * Convert an instance of StrategyQuotes to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/StrategyQuotesGreek.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/StrategyQuotesGreek.java new file mode 100644 index 0000000000..f93dd10afc --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/StrategyQuotesGreek.java @@ -0,0 +1,476 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * StrategyQuotesGreek + */@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class StrategyQuotesGreek { + public static final String SERIALIZED_NAME_DELTA = "delta"; + @SerializedName(SERIALIZED_NAME_DELTA) + private Double delta; + + public static final String SERIALIZED_NAME_GAMMA = "gamma"; + @SerializedName(SERIALIZED_NAME_GAMMA) + private Double gamma; + + public static final String SERIALIZED_NAME_THETA = "theta"; + @SerializedName(SERIALIZED_NAME_THETA) + private Double theta; + + public static final String SERIALIZED_NAME_VEGA = "vega"; + @SerializedName(SERIALIZED_NAME_VEGA) + private Double vega; + + public static final String SERIALIZED_NAME_RHO = "rho"; + @SerializedName(SERIALIZED_NAME_RHO) + private Double rho; + + public StrategyQuotesGreek() { + } + + public StrategyQuotesGreek delta(Double delta) { + + + + + this.delta = delta; + return this; + } + + public StrategyQuotesGreek delta(Integer delta) { + + + + + this.delta = delta.doubleValue(); + return this; + } + + /** + * Get delta + * @return delta + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "0.1", value = "") + + public Double getDelta() { + return delta; + } + + + public void setDelta(Double delta) { + + + + this.delta = delta; + } + + + public StrategyQuotesGreek gamma(Double gamma) { + + + + + this.gamma = gamma; + return this; + } + + public StrategyQuotesGreek gamma(Integer gamma) { + + + + + this.gamma = gamma.doubleValue(); + return this; + } + + /** + * Get gamma + * @return gamma + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "0.1", value = "") + + public Double getGamma() { + return gamma; + } + + + public void setGamma(Double gamma) { + + + + this.gamma = gamma; + } + + + public StrategyQuotesGreek theta(Double theta) { + + + + + this.theta = theta; + return this; + } + + public StrategyQuotesGreek theta(Integer theta) { + + + + + this.theta = theta.doubleValue(); + return this; + } + + /** + * Get theta + * @return theta + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "0.1", value = "") + + public Double getTheta() { + return theta; + } + + + public void setTheta(Double theta) { + + + + this.theta = theta; + } + + + public StrategyQuotesGreek vega(Double vega) { + + + + + this.vega = vega; + return this; + } + + public StrategyQuotesGreek vega(Integer vega) { + + + + + this.vega = vega.doubleValue(); + return this; + } + + /** + * Get vega + * @return vega + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "0.1", value = "") + + public Double getVega() { + return vega; + } + + + public void setVega(Double vega) { + + + + this.vega = vega; + } + + + public StrategyQuotesGreek rho(Double rho) { + + + + + this.rho = rho; + return this; + } + + public StrategyQuotesGreek rho(Integer rho) { + + + + + this.rho = rho.doubleValue(); + return this; + } + + /** + * Get rho + * @return rho + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "0.1", value = "") + + public Double getRho() { + return rho; + } + + + public void setRho(Double rho) { + + + + this.rho = rho; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the StrategyQuotesGreek instance itself + */ + public StrategyQuotesGreek putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StrategyQuotesGreek strategyQuotesGreek = (StrategyQuotesGreek) o; + return Objects.equals(this.delta, strategyQuotesGreek.delta) && + Objects.equals(this.gamma, strategyQuotesGreek.gamma) && + Objects.equals(this.theta, strategyQuotesGreek.theta) && + Objects.equals(this.vega, strategyQuotesGreek.vega) && + Objects.equals(this.rho, strategyQuotesGreek.rho)&& + Objects.equals(this.additionalProperties, strategyQuotesGreek.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(delta, gamma, theta, vega, rho, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StrategyQuotesGreek {\n"); + sb.append(" delta: ").append(toIndentedString(delta)).append("\n"); + sb.append(" gamma: ").append(toIndentedString(gamma)).append("\n"); + sb.append(" theta: ").append(toIndentedString(theta)).append("\n"); + sb.append(" vega: ").append(toIndentedString(vega)).append("\n"); + sb.append(" rho: ").append(toIndentedString(rho)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("delta"); + openapiFields.add("gamma"); + openapiFields.add("theta"); + openapiFields.add("vega"); + openapiFields.add("rho"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to StrategyQuotesGreek + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!StrategyQuotesGreek.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StrategyQuotesGreek is not found in the empty JSON string", StrategyQuotesGreek.openapiRequiredFields.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StrategyQuotesGreek.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StrategyQuotesGreek' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StrategyQuotesGreek.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StrategyQuotesGreek value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public StrategyQuotesGreek read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + StrategyQuotesGreek instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StrategyQuotesGreek given an JSON string + * + * @param jsonString JSON string + * @return An instance of StrategyQuotesGreek + * @throws IOException if the JSON string is invalid with respect to StrategyQuotesGreek + */ + public static StrategyQuotesGreek fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StrategyQuotesGreek.class); + } + + /** + * Convert an instance of StrategyQuotesGreek to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/SubPeriodReturnRate.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/SubPeriodReturnRate.java new file mode 100644 index 0000000000..a2ada3e162 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/SubPeriodReturnRate.java @@ -0,0 +1,381 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.time.LocalDate; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * SubPeriodReturnRate + */@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class SubPeriodReturnRate { + public static final String SERIALIZED_NAME_PERIOD_START = "periodStart"; + @SerializedName(SERIALIZED_NAME_PERIOD_START) + private LocalDate periodStart; + + public static final String SERIALIZED_NAME_PERIOD_END = "periodEnd"; + @SerializedName(SERIALIZED_NAME_PERIOD_END) + private LocalDate periodEnd; + + public static final String SERIALIZED_NAME_RATE_OF_RETURN = "rateOfReturn"; + @SerializedName(SERIALIZED_NAME_RATE_OF_RETURN) + private Double rateOfReturn; + + public SubPeriodReturnRate() { + } + + public SubPeriodReturnRate periodStart(LocalDate periodStart) { + + + + + this.periodStart = periodStart; + return this; + } + + /** + * Date used to specify timeframe for a reporting call (in YYYY-MM-DD format) + * @return periodStart + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Sun Jan 23 16:00:00 PST 2022", value = "Date used to specify timeframe for a reporting call (in YYYY-MM-DD format)") + + public LocalDate getPeriodStart() { + return periodStart; + } + + + public void setPeriodStart(LocalDate periodStart) { + + + + this.periodStart = periodStart; + } + + + public SubPeriodReturnRate periodEnd(LocalDate periodEnd) { + + + + + this.periodEnd = periodEnd; + return this; + } + + /** + * Date used to specify timeframe for a reporting call (in YYYY-MM-DD format) + * @return periodEnd + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Sun Jan 23 16:00:00 PST 2022", value = "Date used to specify timeframe for a reporting call (in YYYY-MM-DD format)") + + public LocalDate getPeriodEnd() { + return periodEnd; + } + + + public void setPeriodEnd(LocalDate periodEnd) { + + + + this.periodEnd = periodEnd; + } + + + public SubPeriodReturnRate rateOfReturn(Double rateOfReturn) { + + + + + this.rateOfReturn = rateOfReturn; + return this; + } + + public SubPeriodReturnRate rateOfReturn(Integer rateOfReturn) { + + + + + this.rateOfReturn = rateOfReturn.doubleValue(); + return this; + } + + /** + * The return rate for the given period + * @return rateOfReturn + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "0.012312367452", value = "The return rate for the given period") + + public Double getRateOfReturn() { + return rateOfReturn; + } + + + public void setRateOfReturn(Double rateOfReturn) { + + + + this.rateOfReturn = rateOfReturn; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SubPeriodReturnRate instance itself + */ + public SubPeriodReturnRate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SubPeriodReturnRate subPeriodReturnRate = (SubPeriodReturnRate) o; + return Objects.equals(this.periodStart, subPeriodReturnRate.periodStart) && + Objects.equals(this.periodEnd, subPeriodReturnRate.periodEnd) && + Objects.equals(this.rateOfReturn, subPeriodReturnRate.rateOfReturn)&& + Objects.equals(this.additionalProperties, subPeriodReturnRate.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(periodStart, periodEnd, rateOfReturn, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SubPeriodReturnRate {\n"); + sb.append(" periodStart: ").append(toIndentedString(periodStart)).append("\n"); + sb.append(" periodEnd: ").append(toIndentedString(periodEnd)).append("\n"); + sb.append(" rateOfReturn: ").append(toIndentedString(rateOfReturn)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("periodStart"); + openapiFields.add("periodEnd"); + openapiFields.add("rateOfReturn"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to SubPeriodReturnRate + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!SubPeriodReturnRate.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SubPeriodReturnRate is not found in the empty JSON string", SubPeriodReturnRate.openapiRequiredFields.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SubPeriodReturnRate.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SubPeriodReturnRate' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SubPeriodReturnRate.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SubPeriodReturnRate value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SubPeriodReturnRate read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + SubPeriodReturnRate instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SubPeriodReturnRate given an JSON string + * + * @param jsonString JSON string + * @return An instance of SubPeriodReturnRate + * @throws IOException if the JSON string is invalid with respect to SubPeriodReturnRate + */ + public static SubPeriodReturnRate fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SubPeriodReturnRate.class); + } + + /** + * Convert an instance of SubPeriodReturnRate to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/Symbol.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/Symbol.java new file mode 100644 index 0000000000..5ff01445ff --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/Symbol.java @@ -0,0 +1,624 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.Currency; +import com.konfigthis.client.model.Exchange; +import com.konfigthis.client.model.FigiInstrumentNullable; +import com.konfigthis.client.model.SecurityType; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Symbol + */ +@ApiModel(description = "Symbol")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class Symbol { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private UUID id; + + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + @SerializedName(SERIALIZED_NAME_SYMBOL) + private String symbol; + + public static final String SERIALIZED_NAME_RAW_SYMBOL = "raw_symbol"; + @SerializedName(SERIALIZED_NAME_RAW_SYMBOL) + private String rawSymbol; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + private Currency currency; + + public static final String SERIALIZED_NAME_EXCHANGE = "exchange"; + @SerializedName(SERIALIZED_NAME_EXCHANGE) + private Exchange exchange; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private SecurityType type; + + public static final String SERIALIZED_NAME_FIGI_CODE = "figi_code"; + @SerializedName(SERIALIZED_NAME_FIGI_CODE) + private String figiCode; + + public static final String SERIALIZED_NAME_FIGI_INSTRUMENT = "figi_instrument"; + @SerializedName(SERIALIZED_NAME_FIGI_INSTRUMENT) + private FigiInstrumentNullable figiInstrument; + + public Symbol() { + } + + public Symbol id(UUID id) { + + + + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getId() { + return id; + } + + + public void setId(UUID id) { + + + + this.id = id; + } + + + public Symbol symbol(String symbol) { + + + + + this.symbol = symbol; + return this; + } + + /** + * Get symbol + * @return symbol + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "VAB.TO", value = "") + + public String getSymbol() { + return symbol; + } + + + public void setSymbol(String symbol) { + + + + this.symbol = symbol; + } + + + public Symbol rawSymbol(String rawSymbol) { + + + + + this.rawSymbol = rawSymbol; + return this; + } + + /** + * Get rawSymbol + * @return rawSymbol + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "VAB", value = "") + + public String getRawSymbol() { + return rawSymbol; + } + + + public void setRawSymbol(String rawSymbol) { + + + + this.rawSymbol = rawSymbol; + } + + + public Symbol name(String name) { + + + + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Vanguard Canadian Aggregate Bond Index ETF", value = "") + + public String getName() { + return name; + } + + + public void setName(String name) { + + + + this.name = name; + } + + + public Symbol currency(Currency currency) { + + + + + this.currency = currency; + return this; + } + + /** + * Get currency + * @return currency + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Currency getCurrency() { + return currency; + } + + + public void setCurrency(Currency currency) { + + + + this.currency = currency; + } + + + public Symbol exchange(Exchange exchange) { + + + + + this.exchange = exchange; + return this; + } + + /** + * Get exchange + * @return exchange + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Exchange getExchange() { + return exchange; + } + + + public void setExchange(Exchange exchange) { + + + + this.exchange = exchange; + } + + + public Symbol type(SecurityType type) { + + + + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public SecurityType getType() { + return type; + } + + + public void setType(SecurityType type) { + + + + this.type = type; + } + + + public Symbol figiCode(String figiCode) { + + + + + this.figiCode = figiCode; + return this; + } + + /** + * Get figiCode + * @return figiCode + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "BBG000B9XRY4", value = "") + + public String getFigiCode() { + return figiCode; + } + + + public void setFigiCode(String figiCode) { + + + + this.figiCode = figiCode; + } + + + public Symbol figiInstrument(FigiInstrumentNullable figiInstrument) { + + + + + this.figiInstrument = figiInstrument; + return this; + } + + /** + * Get figiInstrument + * @return figiInstrument + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public FigiInstrumentNullable getFigiInstrument() { + return figiInstrument; + } + + + public void setFigiInstrument(FigiInstrumentNullable figiInstrument) { + + + + this.figiInstrument = figiInstrument; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Symbol instance itself + */ + public Symbol putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Symbol symbol = (Symbol) o; + return Objects.equals(this.id, symbol.id) && + Objects.equals(this.symbol, symbol.symbol) && + Objects.equals(this.rawSymbol, symbol.rawSymbol) && + Objects.equals(this.name, symbol.name) && + Objects.equals(this.currency, symbol.currency) && + Objects.equals(this.exchange, symbol.exchange) && + Objects.equals(this.type, symbol.type) && + Objects.equals(this.figiCode, symbol.figiCode) && + Objects.equals(this.figiInstrument, symbol.figiInstrument)&& + Objects.equals(this.additionalProperties, symbol.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, symbol, rawSymbol, name, currency, exchange, type, figiCode, figiInstrument, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Symbol {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" rawSymbol: ").append(toIndentedString(rawSymbol)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append(" exchange: ").append(toIndentedString(exchange)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" figiCode: ").append(toIndentedString(figiCode)).append("\n"); + sb.append(" figiInstrument: ").append(toIndentedString(figiInstrument)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("symbol"); + openapiFields.add("raw_symbol"); + openapiFields.add("name"); + openapiFields.add("currency"); + openapiFields.add("exchange"); + openapiFields.add("type"); + openapiFields.add("figi_code"); + openapiFields.add("figi_instrument"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to Symbol + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!Symbol.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Symbol is not found in the empty JSON string", Symbol.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("symbol") != null && !jsonObj.get("symbol").isJsonNull()) && !jsonObj.get("symbol").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `symbol` to be a primitive type in the JSON string but got `%s`", jsonObj.get("symbol").toString())); + } + if ((jsonObj.get("raw_symbol") != null && !jsonObj.get("raw_symbol").isJsonNull()) && !jsonObj.get("raw_symbol").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `raw_symbol` to be a primitive type in the JSON string but got `%s`", jsonObj.get("raw_symbol").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `currency` + if (jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) { + Currency.validateJsonObject(jsonObj.getAsJsonObject("currency")); + } + // validate the optional field `exchange` + if (jsonObj.get("exchange") != null && !jsonObj.get("exchange").isJsonNull()) { + Exchange.validateJsonObject(jsonObj.getAsJsonObject("exchange")); + } + // validate the optional field `type` + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) { + SecurityType.validateJsonObject(jsonObj.getAsJsonObject("type")); + } + if (!jsonObj.get("figi_code").isJsonNull() && (jsonObj.get("figi_code") != null && !jsonObj.get("figi_code").isJsonNull()) && !jsonObj.get("figi_code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `figi_code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("figi_code").toString())); + } + // validate the optional field `figi_instrument` + if (jsonObj.get("figi_instrument") != null && !jsonObj.get("figi_instrument").isJsonNull()) { + FigiInstrumentNullable.validateJsonObject(jsonObj.getAsJsonObject("figi_instrument")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Symbol.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Symbol' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Symbol.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Symbol value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Symbol read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + Symbol instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Symbol given an JSON string + * + * @param jsonString JSON string + * @return An instance of Symbol + * @throws IOException if the JSON string is invalid with respect to Symbol + */ + public static Symbol fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Symbol.class); + } + + /** + * Convert an instance of Symbol to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/SymbolQuery.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/SymbolQuery.java new file mode 100644 index 0000000000..3ccdfd34ca --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/SymbolQuery.java @@ -0,0 +1,291 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Symbol query for searching for symbols + */ +@ApiModel(description = "Symbol query for searching for symbols")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class SymbolQuery { + public static final String SERIALIZED_NAME_SUBSTRING = "substring"; + @SerializedName(SERIALIZED_NAME_SUBSTRING) + private String substring; + + public SymbolQuery() { + } + + public SymbolQuery substring(String substring) { + + + + + this.substring = substring; + return this; + } + + /** + * Get substring + * @return substring + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "apple", value = "") + + public String getSubstring() { + return substring; + } + + + public void setSubstring(String substring) { + + + + this.substring = substring; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SymbolQuery instance itself + */ + public SymbolQuery putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SymbolQuery symbolQuery = (SymbolQuery) o; + return Objects.equals(this.substring, symbolQuery.substring)&& + Objects.equals(this.additionalProperties, symbolQuery.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(substring, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SymbolQuery {\n"); + sb.append(" substring: ").append(toIndentedString(substring)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("substring"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to SymbolQuery + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!SymbolQuery.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SymbolQuery is not found in the empty JSON string", SymbolQuery.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("substring") != null && !jsonObj.get("substring").isJsonNull()) && !jsonObj.get("substring").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `substring` to be a primitive type in the JSON string but got `%s`", jsonObj.get("substring").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SymbolQuery.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SymbolQuery' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SymbolQuery.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SymbolQuery value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SymbolQuery read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + SymbolQuery instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SymbolQuery given an JSON string + * + * @param jsonString JSON string + * @return An instance of SymbolQuery + * @throws IOException if the JSON string is invalid with respect to SymbolQuery + */ + public static SymbolQuery fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SymbolQuery.class); + } + + /** + * Convert an instance of SymbolQuery to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/SymbolsQuotesInner.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/SymbolsQuotesInner.java new file mode 100644 index 0000000000..2f9f9340ba --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/SymbolsQuotesInner.java @@ -0,0 +1,517 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.UniversalSymbol; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * SymbolsQuotesInner + */@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class SymbolsQuotesInner { + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + @SerializedName(SERIALIZED_NAME_SYMBOL) + private UniversalSymbol symbol; + + public static final String SERIALIZED_NAME_BID_PRICE = "bid_price"; + @SerializedName(SERIALIZED_NAME_BID_PRICE) + private Double bidPrice; + + public static final String SERIALIZED_NAME_ASK_PRICE = "ask_price"; + @SerializedName(SERIALIZED_NAME_ASK_PRICE) + private Double askPrice; + + public static final String SERIALIZED_NAME_LAST_TRADE_PRICE = "last_trade_price"; + @SerializedName(SERIALIZED_NAME_LAST_TRADE_PRICE) + private Double lastTradePrice; + + public static final String SERIALIZED_NAME_BID_SIZE = "bid_size"; + @SerializedName(SERIALIZED_NAME_BID_SIZE) + private Double bidSize; + + public static final String SERIALIZED_NAME_ASK_SIZE = "ask_size"; + @SerializedName(SERIALIZED_NAME_ASK_SIZE) + private Double askSize; + + public SymbolsQuotesInner() { + } + + public SymbolsQuotesInner symbol(UniversalSymbol symbol) { + + + + + this.symbol = symbol; + return this; + } + + /** + * Get symbol + * @return symbol + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public UniversalSymbol getSymbol() { + return symbol; + } + + + public void setSymbol(UniversalSymbol symbol) { + + + + this.symbol = symbol; + } + + + public SymbolsQuotesInner bidPrice(Double bidPrice) { + + + + + this.bidPrice = bidPrice; + return this; + } + + public SymbolsQuotesInner bidPrice(Integer bidPrice) { + + + + + this.bidPrice = bidPrice.doubleValue(); + return this; + } + + /** + * Get bidPrice + * @return bidPrice + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "8.43", value = "") + + public Double getBidPrice() { + return bidPrice; + } + + + public void setBidPrice(Double bidPrice) { + + + + this.bidPrice = bidPrice; + } + + + public SymbolsQuotesInner askPrice(Double askPrice) { + + + + + this.askPrice = askPrice; + return this; + } + + public SymbolsQuotesInner askPrice(Integer askPrice) { + + + + + this.askPrice = askPrice.doubleValue(); + return this; + } + + /** + * Get askPrice + * @return askPrice + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "8.43", value = "") + + public Double getAskPrice() { + return askPrice; + } + + + public void setAskPrice(Double askPrice) { + + + + this.askPrice = askPrice; + } + + + public SymbolsQuotesInner lastTradePrice(Double lastTradePrice) { + + + + + this.lastTradePrice = lastTradePrice; + return this; + } + + public SymbolsQuotesInner lastTradePrice(Integer lastTradePrice) { + + + + + this.lastTradePrice = lastTradePrice.doubleValue(); + return this; + } + + /** + * Get lastTradePrice + * @return lastTradePrice + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "8.74", value = "") + + public Double getLastTradePrice() { + return lastTradePrice; + } + + + public void setLastTradePrice(Double lastTradePrice) { + + + + this.lastTradePrice = lastTradePrice; + } + + + public SymbolsQuotesInner bidSize(Double bidSize) { + + + + + this.bidSize = bidSize; + return this; + } + + public SymbolsQuotesInner bidSize(Integer bidSize) { + + + + + this.bidSize = bidSize.doubleValue(); + return this; + } + + /** + * Get bidSize + * @return bidSize + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "260", value = "") + + public Double getBidSize() { + return bidSize; + } + + + public void setBidSize(Double bidSize) { + + + + this.bidSize = bidSize; + } + + + public SymbolsQuotesInner askSize(Double askSize) { + + + + + this.askSize = askSize; + return this; + } + + public SymbolsQuotesInner askSize(Integer askSize) { + + + + + this.askSize = askSize.doubleValue(); + return this; + } + + /** + * Get askSize + * @return askSize + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "344", value = "") + + public Double getAskSize() { + return askSize; + } + + + public void setAskSize(Double askSize) { + + + + this.askSize = askSize; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SymbolsQuotesInner instance itself + */ + public SymbolsQuotesInner putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SymbolsQuotesInner symbolsQuotesInner = (SymbolsQuotesInner) o; + return Objects.equals(this.symbol, symbolsQuotesInner.symbol) && + Objects.equals(this.bidPrice, symbolsQuotesInner.bidPrice) && + Objects.equals(this.askPrice, symbolsQuotesInner.askPrice) && + Objects.equals(this.lastTradePrice, symbolsQuotesInner.lastTradePrice) && + Objects.equals(this.bidSize, symbolsQuotesInner.bidSize) && + Objects.equals(this.askSize, symbolsQuotesInner.askSize)&& + Objects.equals(this.additionalProperties, symbolsQuotesInner.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(symbol, bidPrice, askPrice, lastTradePrice, bidSize, askSize, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SymbolsQuotesInner {\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" bidPrice: ").append(toIndentedString(bidPrice)).append("\n"); + sb.append(" askPrice: ").append(toIndentedString(askPrice)).append("\n"); + sb.append(" lastTradePrice: ").append(toIndentedString(lastTradePrice)).append("\n"); + sb.append(" bidSize: ").append(toIndentedString(bidSize)).append("\n"); + sb.append(" askSize: ").append(toIndentedString(askSize)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("symbol"); + openapiFields.add("bid_price"); + openapiFields.add("ask_price"); + openapiFields.add("last_trade_price"); + openapiFields.add("bid_size"); + openapiFields.add("ask_size"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to SymbolsQuotesInner + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!SymbolsQuotesInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SymbolsQuotesInner is not found in the empty JSON string", SymbolsQuotesInner.openapiRequiredFields.toString())); + } + } + // validate the optional field `symbol` + if (jsonObj.get("symbol") != null && !jsonObj.get("symbol").isJsonNull()) { + UniversalSymbol.validateJsonObject(jsonObj.getAsJsonObject("symbol")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SymbolsQuotesInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SymbolsQuotesInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SymbolsQuotesInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SymbolsQuotesInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SymbolsQuotesInner read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + SymbolsQuotesInner instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SymbolsQuotesInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of SymbolsQuotesInner + * @throws IOException if the JSON string is invalid with respect to SymbolsQuotesInner + */ + public static SymbolsQuotesInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SymbolsQuotesInner.class); + } + + /** + * Convert an instance of SymbolsQuotesInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/TargetAsset.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/TargetAsset.java new file mode 100644 index 0000000000..8386b3e2b5 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/TargetAsset.java @@ -0,0 +1,522 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.UniversalSymbol; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Target percentage of a certain asset + */ +@ApiModel(description = "Target percentage of a certain asset")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class TargetAsset { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private UUID id; + + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + @SerializedName(SERIALIZED_NAME_SYMBOL) + private UniversalSymbol symbol; + + public static final String SERIALIZED_NAME_PERCENT = "percent"; + @SerializedName(SERIALIZED_NAME_PERCENT) + private Double percent; + + public static final String SERIALIZED_NAME_IS_SUPPORTED = "is_supported"; + @SerializedName(SERIALIZED_NAME_IS_SUPPORTED) + private Boolean isSupported; + + public static final String SERIALIZED_NAME_IS_EXCLUDED = "is_excluded"; + @SerializedName(SERIALIZED_NAME_IS_EXCLUDED) + private Boolean isExcluded; + + public static final String SERIALIZED_NAME_META = "meta"; + @SerializedName(SERIALIZED_NAME_META) + private Map meta = null; + + public TargetAsset() { + } + + public TargetAsset id(UUID id) { + + + + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getId() { + return id; + } + + + public void setId(UUID id) { + + + + this.id = id; + } + + + public TargetAsset symbol(UniversalSymbol symbol) { + + + + + this.symbol = symbol; + return this; + } + + /** + * Get symbol + * @return symbol + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public UniversalSymbol getSymbol() { + return symbol; + } + + + public void setSymbol(UniversalSymbol symbol) { + + + + this.symbol = symbol; + } + + + public TargetAsset percent(Double percent) { + if (percent != null && percent < 0) { + throw new IllegalArgumentException("Invalid value for percent. Must be greater than or equal to 0."); + } + if (percent != null && percent > 100) { + throw new IllegalArgumentException("Invalid value for percent. Must be less than or equal to 100."); + } + + + this.percent = percent; + return this; + } + + public TargetAsset percent(Integer percent) { + if (percent != null && percent < 0) { + throw new IllegalArgumentException("Invalid value for percent. Must be greater than or equal to 0."); + } + if (percent != null && percent > 100) { + throw new IllegalArgumentException("Invalid value for percent. Must be less than or equal to 100."); + } + + + this.percent = percent.doubleValue(); + return this; + } + + /** + * Get percent + * minimum: 0 + * maximum: 100 + * @return percent + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "90", value = "") + + public Double getPercent() { + return percent; + } + + + public void setPercent(Double percent) { + if (percent != null && percent < 0) { + throw new IllegalArgumentException("Invalid value for percent. Must be greater than or equal to 0."); + } + if (percent != null && percent > 100) { + throw new IllegalArgumentException("Invalid value for percent. Must be less than or equal to 100."); + } + + this.percent = percent; + } + + + public TargetAsset isSupported(Boolean isSupported) { + + + + + this.isSupported = isSupported; + return this; + } + + /** + * Get isSupported + * @return isSupported + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "true", value = "") + + public Boolean getIsSupported() { + return isSupported; + } + + + public void setIsSupported(Boolean isSupported) { + + + + this.isSupported = isSupported; + } + + + public TargetAsset isExcluded(Boolean isExcluded) { + + + + + this.isExcluded = isExcluded; + return this; + } + + /** + * Get isExcluded + * @return isExcluded + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "true", value = "") + + public Boolean getIsExcluded() { + return isExcluded; + } + + + public void setIsExcluded(Boolean isExcluded) { + + + + this.isExcluded = isExcluded; + } + + + public TargetAsset meta(Map meta) { + + + + + this.meta = meta; + return this; + } + + public TargetAsset putMetaItem(String key, Object metaItem) { + if (this.meta == null) { + this.meta = new HashMap<>(); + } + this.meta.put(key, metaItem); + return this; + } + + /** + * Get meta + * @return meta + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Map getMeta() { + return meta; + } + + + public void setMeta(Map meta) { + + + + this.meta = meta; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TargetAsset instance itself + */ + public TargetAsset putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TargetAsset targetAsset = (TargetAsset) o; + return Objects.equals(this.id, targetAsset.id) && + Objects.equals(this.symbol, targetAsset.symbol) && + Objects.equals(this.percent, targetAsset.percent) && + Objects.equals(this.isSupported, targetAsset.isSupported) && + Objects.equals(this.isExcluded, targetAsset.isExcluded) && + Objects.equals(this.meta, targetAsset.meta)&& + Objects.equals(this.additionalProperties, targetAsset.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, symbol, percent, isSupported, isExcluded, meta, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TargetAsset {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" percent: ").append(toIndentedString(percent)).append("\n"); + sb.append(" isSupported: ").append(toIndentedString(isSupported)).append("\n"); + sb.append(" isExcluded: ").append(toIndentedString(isExcluded)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("symbol"); + openapiFields.add("percent"); + openapiFields.add("is_supported"); + openapiFields.add("is_excluded"); + openapiFields.add("meta"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to TargetAsset + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!TargetAsset.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TargetAsset is not found in the empty JSON string", TargetAsset.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `symbol` + if (jsonObj.get("symbol") != null && !jsonObj.get("symbol").isJsonNull()) { + UniversalSymbol.validateJsonObject(jsonObj.getAsJsonObject("symbol")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TargetAsset.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TargetAsset' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TargetAsset.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TargetAsset value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public TargetAsset read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + TargetAsset instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TargetAsset given an JSON string + * + * @param jsonString JSON string + * @return An instance of TargetAsset + * @throws IOException if the JSON string is invalid with respect to TargetAsset + */ + public static TargetAsset fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TargetAsset.class); + } + + /** + * Convert an instance of TargetAsset to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/TimeInForceStrict.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/TimeInForceStrict.java new file mode 100644 index 0000000000..dd4fb28059 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/TimeInForceStrict.java @@ -0,0 +1,74 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Trade time in force examples: * FOK - Fill Or Kill * Day - Day * GTC - Good Til Canceled + */ +@JsonAdapter(TimeInForceStrict.Adapter.class)public enum TimeInForceStrict { + + FOK("FOK"), + + DAY("Day"), + + GTC("GTC"); + + private String value; + + TimeInForceStrict(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TimeInForceStrict fromValue(String value) { + for (TimeInForceStrict b : TimeInForceStrict.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TimeInForceStrict enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TimeInForceStrict read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TimeInForceStrict.fromValue(value); + } + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/Trade.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/Trade.java new file mode 100644 index 0000000000..52f49d18a8 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/Trade.java @@ -0,0 +1,618 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.Account; +import com.konfigthis.client.model.BrokerageSymbol; +import com.konfigthis.client.model.UniversalSymbol; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * A trade object + */ +@ApiModel(description = "A trade object")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class Trade { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private UUID id; + + public static final String SERIALIZED_NAME_ACCOUNT = "account"; + @SerializedName(SERIALIZED_NAME_ACCOUNT) + private Account account; + + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + @SerializedName(SERIALIZED_NAME_SYMBOL) + private BrokerageSymbol symbol; + + public static final String SERIALIZED_NAME_UNIVERSAL_SYMBOL = "universal_symbol"; + @SerializedName(SERIALIZED_NAME_UNIVERSAL_SYMBOL) + private UniversalSymbol universalSymbol; + + /** + * Gets or Sets action + */ + @JsonAdapter(ActionEnum.Adapter.class) + public enum ActionEnum { + BUY("BUY"), + + SELL("SELL"); + + private String value; + + ActionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ActionEnum fromValue(String value) { + for (ActionEnum b : ActionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ActionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ActionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ActionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_ACTION = "action"; + @SerializedName(SERIALIZED_NAME_ACTION) + private ActionEnum action; + + public static final String SERIALIZED_NAME_UNITS = "units"; + @SerializedName(SERIALIZED_NAME_UNITS) + private Integer units; + + public static final String SERIALIZED_NAME_PRICE = "price"; + @SerializedName(SERIALIZED_NAME_PRICE) + private Double price; + + public static final String SERIALIZED_NAME_SEQUENCE = "sequence"; + @SerializedName(SERIALIZED_NAME_SEQUENCE) + private Integer sequence; + + public Trade() { + } + + public Trade id(UUID id) { + + + + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getId() { + return id; + } + + + public void setId(UUID id) { + + + + this.id = id; + } + + + public Trade account(Account account) { + + + + + this.account = account; + return this; + } + + /** + * Get account + * @return account + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Account getAccount() { + return account; + } + + + public void setAccount(Account account) { + + + + this.account = account; + } + + + public Trade symbol(BrokerageSymbol symbol) { + + + + + this.symbol = symbol; + return this; + } + + /** + * Get symbol + * @return symbol + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public BrokerageSymbol getSymbol() { + return symbol; + } + + + public void setSymbol(BrokerageSymbol symbol) { + + + + this.symbol = symbol; + } + + + public Trade universalSymbol(UniversalSymbol universalSymbol) { + + + + + this.universalSymbol = universalSymbol; + return this; + } + + /** + * Get universalSymbol + * @return universalSymbol + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public UniversalSymbol getUniversalSymbol() { + return universalSymbol; + } + + + public void setUniversalSymbol(UniversalSymbol universalSymbol) { + + + + this.universalSymbol = universalSymbol; + } + + + public Trade action(ActionEnum action) { + + + + + this.action = action; + return this; + } + + /** + * Get action + * @return action + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "BUY", value = "") + + public ActionEnum getAction() { + return action; + } + + + public void setAction(ActionEnum action) { + + + + this.action = action; + } + + + public Trade units(Integer units) { + + + + + this.units = units; + return this; + } + + /** + * Get units + * @return units + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "6", value = "") + + public Integer getUnits() { + return units; + } + + + public void setUnits(Integer units) { + + + + this.units = units; + } + + + public Trade price(Double price) { + + + + + this.price = price; + return this; + } + + public Trade price(Integer price) { + + + + + this.price = price.doubleValue(); + return this; + } + + /** + * Get price + * @return price + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "24.81", value = "") + + public Double getPrice() { + return price; + } + + + public void setPrice(Double price) { + + + + this.price = price; + } + + + public Trade sequence(Integer sequence) { + + + + + this.sequence = sequence; + return this; + } + + /** + * Get sequence + * @return sequence + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "1", value = "") + + public Integer getSequence() { + return sequence; + } + + + public void setSequence(Integer sequence) { + + + + this.sequence = sequence; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Trade instance itself + */ + public Trade putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Trade trade = (Trade) o; + return Objects.equals(this.id, trade.id) && + Objects.equals(this.account, trade.account) && + Objects.equals(this.symbol, trade.symbol) && + Objects.equals(this.universalSymbol, trade.universalSymbol) && + Objects.equals(this.action, trade.action) && + Objects.equals(this.units, trade.units) && + Objects.equals(this.price, trade.price) && + Objects.equals(this.sequence, trade.sequence)&& + Objects.equals(this.additionalProperties, trade.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, account, symbol, universalSymbol, action, units, price, sequence, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Trade {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" account: ").append(toIndentedString(account)).append("\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" universalSymbol: ").append(toIndentedString(universalSymbol)).append("\n"); + sb.append(" action: ").append(toIndentedString(action)).append("\n"); + sb.append(" units: ").append(toIndentedString(units)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append(" sequence: ").append(toIndentedString(sequence)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("account"); + openapiFields.add("symbol"); + openapiFields.add("universal_symbol"); + openapiFields.add("action"); + openapiFields.add("units"); + openapiFields.add("price"); + openapiFields.add("sequence"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to Trade + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!Trade.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Trade is not found in the empty JSON string", Trade.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `account` + if (jsonObj.get("account") != null && !jsonObj.get("account").isJsonNull()) { + Account.validateJsonObject(jsonObj.getAsJsonObject("account")); + } + // validate the optional field `symbol` + if (jsonObj.get("symbol") != null && !jsonObj.get("symbol").isJsonNull()) { + BrokerageSymbol.validateJsonObject(jsonObj.getAsJsonObject("symbol")); + } + // validate the optional field `universal_symbol` + if (jsonObj.get("universal_symbol") != null && !jsonObj.get("universal_symbol").isJsonNull()) { + UniversalSymbol.validateJsonObject(jsonObj.getAsJsonObject("universal_symbol")); + } + if ((jsonObj.get("action") != null && !jsonObj.get("action").isJsonNull()) && !jsonObj.get("action").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `action` to be a primitive type in the JSON string but got `%s`", jsonObj.get("action").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Trade.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Trade' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Trade.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Trade value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Trade read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + Trade instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Trade given an JSON string + * + * @param jsonString JSON string + * @return An instance of Trade + * @throws IOException if the JSON string is invalid with respect to Trade + */ + public static Trade fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Trade.class); + } + + /** + * Convert an instance of Trade to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/TradeExecutionStatus.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/TradeExecutionStatus.java new file mode 100644 index 0000000000..d579d7cdaf --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/TradeExecutionStatus.java @@ -0,0 +1,725 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.BrokerageSymbol; +import com.konfigthis.client.model.Trade; +import com.konfigthis.client.model.UniversalSymbol; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Execution status of a trade + */ +@ApiModel(description = "Execution status of a trade")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class TradeExecutionStatus { + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + @SerializedName(SERIALIZED_NAME_SYMBOL) + private BrokerageSymbol symbol; + + public static final String SERIALIZED_NAME_UNIVERSAL_SYMBOL = "universal_symbol"; + @SerializedName(SERIALIZED_NAME_UNIVERSAL_SYMBOL) + private UniversalSymbol universalSymbol; + + public static final String SERIALIZED_NAME_TRADE = "trade"; + @SerializedName(SERIALIZED_NAME_TRADE) + private Trade trade; + + /** + * Execution state of a trade + */ + @JsonAdapter(StateEnum.Adapter.class) + public enum StateEnum { + EXECUTED("Executed"), + + CANCELED("Canceled"), + + REJECTED("Rejected"), + + FAILED("Failed"), + + NOT_EXECUTED("Not Executed"); + + private String value; + + StateEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StateEnum fromValue(String value) { + for (StateEnum b : StateEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StateEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StateEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StateEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STATE = "state"; + @SerializedName(SERIALIZED_NAME_STATE) + private StateEnum state; + + public static final String SERIALIZED_NAME_FILLED_UNITS = "filled_units"; + @SerializedName(SERIALIZED_NAME_FILLED_UNITS) + private Integer filledUnits; + + /** + * Action of executed trade + */ + @JsonAdapter(ActionEnum.Adapter.class) + public enum ActionEnum { + BUY("BUY"), + + SELL("SELL"); + + private String value; + + ActionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ActionEnum fromValue(String value) { + for (ActionEnum b : ActionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ActionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ActionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ActionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_ACTION = "action"; + @SerializedName(SERIALIZED_NAME_ACTION) + private ActionEnum action; + + public static final String SERIALIZED_NAME_PRICE = "price"; + @SerializedName(SERIALIZED_NAME_PRICE) + private Double price; + + public static final String SERIALIZED_NAME_COMMISSIONS = "commissions"; + @SerializedName(SERIALIZED_NAME_COMMISSIONS) + private Double commissions; + + public static final String SERIALIZED_NAME_META = "meta"; + @SerializedName(SERIALIZED_NAME_META) + private Map meta = null; + + public TradeExecutionStatus() { + } + + public TradeExecutionStatus symbol(BrokerageSymbol symbol) { + + + + + this.symbol = symbol; + return this; + } + + /** + * Get symbol + * @return symbol + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public BrokerageSymbol getSymbol() { + return symbol; + } + + + public void setSymbol(BrokerageSymbol symbol) { + + + + this.symbol = symbol; + } + + + public TradeExecutionStatus universalSymbol(UniversalSymbol universalSymbol) { + + + + + this.universalSymbol = universalSymbol; + return this; + } + + /** + * Get universalSymbol + * @return universalSymbol + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public UniversalSymbol getUniversalSymbol() { + return universalSymbol; + } + + + public void setUniversalSymbol(UniversalSymbol universalSymbol) { + + + + this.universalSymbol = universalSymbol; + } + + + public TradeExecutionStatus trade(Trade trade) { + + + + + this.trade = trade; + return this; + } + + /** + * Get trade + * @return trade + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Trade getTrade() { + return trade; + } + + + public void setTrade(Trade trade) { + + + + this.trade = trade; + } + + + public TradeExecutionStatus state(StateEnum state) { + + + + + this.state = state; + return this; + } + + /** + * Execution state of a trade + * @return state + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "EXECUTED", value = "Execution state of a trade") + + public StateEnum getState() { + return state; + } + + + public void setState(StateEnum state) { + + + + this.state = state; + } + + + public TradeExecutionStatus filledUnits(Integer filledUnits) { + + + + + this.filledUnits = filledUnits; + return this; + } + + /** + * Number of filled units + * @return filledUnits + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "3", value = "Number of filled units") + + public Integer getFilledUnits() { + return filledUnits; + } + + + public void setFilledUnits(Integer filledUnits) { + + + + this.filledUnits = filledUnits; + } + + + public TradeExecutionStatus action(ActionEnum action) { + + + + + this.action = action; + return this; + } + + /** + * Action of executed trade + * @return action + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "SELL", value = "Action of executed trade") + + public ActionEnum getAction() { + return action; + } + + + public void setAction(ActionEnum action) { + + + + this.action = action; + } + + + public TradeExecutionStatus price(Double price) { + + + + + this.price = price; + return this; + } + + public TradeExecutionStatus price(Integer price) { + + + + + this.price = price.doubleValue(); + return this; + } + + /** + * Price of execution + * @return price + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "23.44", value = "Price of execution") + + public Double getPrice() { + return price; + } + + + public void setPrice(Double price) { + + + + this.price = price; + } + + + public TradeExecutionStatus commissions(Double commissions) { + + + + + this.commissions = commissions; + return this; + } + + public TradeExecutionStatus commissions(Integer commissions) { + + + + + this.commissions = commissions.doubleValue(); + return this; + } + + /** + * Fees paid from executing trade + * @return commissions + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "23.44", value = "Fees paid from executing trade") + + public Double getCommissions() { + return commissions; + } + + + public void setCommissions(Double commissions) { + + + + this.commissions = commissions; + } + + + public TradeExecutionStatus meta(Map meta) { + + + + + this.meta = meta; + return this; + } + + public TradeExecutionStatus putMetaItem(String key, Object metaItem) { + if (this.meta == null) { + this.meta = new HashMap<>(); + } + this.meta.put(key, metaItem); + return this; + } + + /** + * Other misc. data + * @return meta + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "{\"canceledUnits\":2}", value = "Other misc. data") + + public Map getMeta() { + return meta; + } + + + public void setMeta(Map meta) { + + + + this.meta = meta; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TradeExecutionStatus instance itself + */ + public TradeExecutionStatus putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TradeExecutionStatus tradeExecutionStatus = (TradeExecutionStatus) o; + return Objects.equals(this.symbol, tradeExecutionStatus.symbol) && + Objects.equals(this.universalSymbol, tradeExecutionStatus.universalSymbol) && + Objects.equals(this.trade, tradeExecutionStatus.trade) && + Objects.equals(this.state, tradeExecutionStatus.state) && + Objects.equals(this.filledUnits, tradeExecutionStatus.filledUnits) && + Objects.equals(this.action, tradeExecutionStatus.action) && + Objects.equals(this.price, tradeExecutionStatus.price) && + Objects.equals(this.commissions, tradeExecutionStatus.commissions) && + Objects.equals(this.meta, tradeExecutionStatus.meta)&& + Objects.equals(this.additionalProperties, tradeExecutionStatus.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(symbol, universalSymbol, trade, state, filledUnits, action, price, commissions, meta, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TradeExecutionStatus {\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" universalSymbol: ").append(toIndentedString(universalSymbol)).append("\n"); + sb.append(" trade: ").append(toIndentedString(trade)).append("\n"); + sb.append(" state: ").append(toIndentedString(state)).append("\n"); + sb.append(" filledUnits: ").append(toIndentedString(filledUnits)).append("\n"); + sb.append(" action: ").append(toIndentedString(action)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append(" commissions: ").append(toIndentedString(commissions)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("symbol"); + openapiFields.add("universal_symbol"); + openapiFields.add("trade"); + openapiFields.add("state"); + openapiFields.add("filled_units"); + openapiFields.add("action"); + openapiFields.add("price"); + openapiFields.add("commissions"); + openapiFields.add("meta"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to TradeExecutionStatus + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!TradeExecutionStatus.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TradeExecutionStatus is not found in the empty JSON string", TradeExecutionStatus.openapiRequiredFields.toString())); + } + } + // validate the optional field `symbol` + if (jsonObj.get("symbol") != null && !jsonObj.get("symbol").isJsonNull()) { + BrokerageSymbol.validateJsonObject(jsonObj.getAsJsonObject("symbol")); + } + // validate the optional field `universal_symbol` + if (jsonObj.get("universal_symbol") != null && !jsonObj.get("universal_symbol").isJsonNull()) { + UniversalSymbol.validateJsonObject(jsonObj.getAsJsonObject("universal_symbol")); + } + // validate the optional field `trade` + if (jsonObj.get("trade") != null && !jsonObj.get("trade").isJsonNull()) { + Trade.validateJsonObject(jsonObj.getAsJsonObject("trade")); + } + if ((jsonObj.get("state") != null && !jsonObj.get("state").isJsonNull()) && !jsonObj.get("state").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `state` to be a primitive type in the JSON string but got `%s`", jsonObj.get("state").toString())); + } + if ((jsonObj.get("action") != null && !jsonObj.get("action").isJsonNull()) && !jsonObj.get("action").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `action` to be a primitive type in the JSON string but got `%s`", jsonObj.get("action").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TradeExecutionStatus.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TradeExecutionStatus' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TradeExecutionStatus.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TradeExecutionStatus value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public TradeExecutionStatus read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + TradeExecutionStatus instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TradeExecutionStatus given an JSON string + * + * @param jsonString JSON string + * @return An instance of TradeExecutionStatus + * @throws IOException if the JSON string is invalid with respect to TradeExecutionStatus + */ + public static TradeExecutionStatus fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TradeExecutionStatus.class); + } + + /** + * Convert an instance of TradeExecutionStatus to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/TradeImpact.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/TradeImpact.java new file mode 100644 index 0000000000..62a261eff4 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/TradeImpact.java @@ -0,0 +1,469 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.Account; +import com.konfigthis.client.model.Currency; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Impact of a group of trade + */ +@ApiModel(description = "Impact of a group of trade")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class TradeImpact { + public static final String SERIALIZED_NAME_ACCOUNT = "account"; + @SerializedName(SERIALIZED_NAME_ACCOUNT) + private Account account; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + private Currency currency; + + public static final String SERIALIZED_NAME_REMAINING_CASH = "remaining_cash"; + @SerializedName(SERIALIZED_NAME_REMAINING_CASH) + private Double remainingCash; + + public static final String SERIALIZED_NAME_ESTIMATED_COMMISSIONS = "estimated_commissions"; + @SerializedName(SERIALIZED_NAME_ESTIMATED_COMMISSIONS) + private Double estimatedCommissions; + + public static final String SERIALIZED_NAME_FOREX_FEES = "forex_fees"; + @SerializedName(SERIALIZED_NAME_FOREX_FEES) + private Double forexFees; + + public TradeImpact() { + } + + public TradeImpact account(Account account) { + + + + + this.account = account; + return this; + } + + /** + * Get account + * @return account + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Account getAccount() { + return account; + } + + + public void setAccount(Account account) { + + + + this.account = account; + } + + + public TradeImpact currency(Currency currency) { + + + + + this.currency = currency; + return this; + } + + /** + * Get currency + * @return currency + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Currency getCurrency() { + return currency; + } + + + public void setCurrency(Currency currency) { + + + + this.currency = currency; + } + + + public TradeImpact remainingCash(Double remainingCash) { + + + + + this.remainingCash = remainingCash; + return this; + } + + public TradeImpact remainingCash(Integer remainingCash) { + + + + + this.remainingCash = remainingCash.doubleValue(); + return this; + } + + /** + * Remaining balance after executing all trades + * @return remainingCash + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "1.01", value = "Remaining balance after executing all trades") + + public Double getRemainingCash() { + return remainingCash; + } + + + public void setRemainingCash(Double remainingCash) { + + + + this.remainingCash = remainingCash; + } + + + public TradeImpact estimatedCommissions(Double estimatedCommissions) { + + + + + this.estimatedCommissions = estimatedCommissions; + return this; + } + + public TradeImpact estimatedCommissions(Integer estimatedCommissions) { + + + + + this.estimatedCommissions = estimatedCommissions.doubleValue(); + return this; + } + + /** + * Total estimated commissions across all trades to make + * @return estimatedCommissions + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "10.05", value = "Total estimated commissions across all trades to make") + + public Double getEstimatedCommissions() { + return estimatedCommissions; + } + + + public void setEstimatedCommissions(Double estimatedCommissions) { + + + + this.estimatedCommissions = estimatedCommissions; + } + + + public TradeImpact forexFees(Double forexFees) { + + + + + this.forexFees = forexFees; + return this; + } + + public TradeImpact forexFees(Integer forexFees) { + + + + + this.forexFees = forexFees.doubleValue(); + return this; + } + + /** + * Estimated forex fees to pay to excute trades + * @return forexFees + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2.01", value = "Estimated forex fees to pay to excute trades") + + public Double getForexFees() { + return forexFees; + } + + + public void setForexFees(Double forexFees) { + + + + this.forexFees = forexFees; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TradeImpact instance itself + */ + public TradeImpact putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TradeImpact tradeImpact = (TradeImpact) o; + return Objects.equals(this.account, tradeImpact.account) && + Objects.equals(this.currency, tradeImpact.currency) && + Objects.equals(this.remainingCash, tradeImpact.remainingCash) && + Objects.equals(this.estimatedCommissions, tradeImpact.estimatedCommissions) && + Objects.equals(this.forexFees, tradeImpact.forexFees)&& + Objects.equals(this.additionalProperties, tradeImpact.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(account, currency, remainingCash, estimatedCommissions, forexFees, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TradeImpact {\n"); + sb.append(" account: ").append(toIndentedString(account)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append(" remainingCash: ").append(toIndentedString(remainingCash)).append("\n"); + sb.append(" estimatedCommissions: ").append(toIndentedString(estimatedCommissions)).append("\n"); + sb.append(" forexFees: ").append(toIndentedString(forexFees)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("account"); + openapiFields.add("currency"); + openapiFields.add("remaining_cash"); + openapiFields.add("estimated_commissions"); + openapiFields.add("forex_fees"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to TradeImpact + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!TradeImpact.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TradeImpact is not found in the empty JSON string", TradeImpact.openapiRequiredFields.toString())); + } + } + // validate the optional field `account` + if (jsonObj.get("account") != null && !jsonObj.get("account").isJsonNull()) { + Account.validateJsonObject(jsonObj.getAsJsonObject("account")); + } + // validate the optional field `currency` + if (jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) { + Currency.validateJsonObject(jsonObj.getAsJsonObject("currency")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TradeImpact.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TradeImpact' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TradeImpact.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TradeImpact value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public TradeImpact read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + TradeImpact instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TradeImpact given an JSON string + * + * @param jsonString JSON string + * @return An instance of TradeImpact + * @throws IOException if the JSON string is invalid with respect to TradeImpact + */ + public static TradeImpact fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TradeImpact.class); + } + + /** + * Convert an instance of TradeImpact to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/TradingCancelUserAccountOrderRequest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/TradingCancelUserAccountOrderRequest.java new file mode 100644 index 0000000000..548036508d --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/TradingCancelUserAccountOrderRequest.java @@ -0,0 +1,291 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * TradingCancelUserAccountOrderRequest + */@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class TradingCancelUserAccountOrderRequest { + public static final String SERIALIZED_NAME_BROKERAGE_ORDER_ID = "brokerage_order_id"; + @SerializedName(SERIALIZED_NAME_BROKERAGE_ORDER_ID) + private UUID brokerageOrderId; + + public TradingCancelUserAccountOrderRequest() { + } + + public TradingCancelUserAccountOrderRequest brokerageOrderId(UUID brokerageOrderId) { + + + + + this.brokerageOrderId = brokerageOrderId; + return this; + } + + /** + * Get brokerageOrderId + * @return brokerageOrderId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getBrokerageOrderId() { + return brokerageOrderId; + } + + + public void setBrokerageOrderId(UUID brokerageOrderId) { + + + + this.brokerageOrderId = brokerageOrderId; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TradingCancelUserAccountOrderRequest instance itself + */ + public TradingCancelUserAccountOrderRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TradingCancelUserAccountOrderRequest tradingCancelUserAccountOrderRequest = (TradingCancelUserAccountOrderRequest) o; + return Objects.equals(this.brokerageOrderId, tradingCancelUserAccountOrderRequest.brokerageOrderId)&& + Objects.equals(this.additionalProperties, tradingCancelUserAccountOrderRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(brokerageOrderId, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TradingCancelUserAccountOrderRequest {\n"); + sb.append(" brokerageOrderId: ").append(toIndentedString(brokerageOrderId)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("brokerage_order_id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to TradingCancelUserAccountOrderRequest + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!TradingCancelUserAccountOrderRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TradingCancelUserAccountOrderRequest is not found in the empty JSON string", TradingCancelUserAccountOrderRequest.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("brokerage_order_id") != null && !jsonObj.get("brokerage_order_id").isJsonNull()) && !jsonObj.get("brokerage_order_id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `brokerage_order_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("brokerage_order_id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TradingCancelUserAccountOrderRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TradingCancelUserAccountOrderRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TradingCancelUserAccountOrderRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TradingCancelUserAccountOrderRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public TradingCancelUserAccountOrderRequest read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + TradingCancelUserAccountOrderRequest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TradingCancelUserAccountOrderRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of TradingCancelUserAccountOrderRequest + * @throws IOException if the JSON string is invalid with respect to TradingCancelUserAccountOrderRequest + */ + public static TradingCancelUserAccountOrderRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TradingCancelUserAccountOrderRequest.class); + } + + /** + * Convert an instance of TradingCancelUserAccountOrderRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/TransactionsStatus.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/TransactionsStatus.java new file mode 100644 index 0000000000..16a771aa3d --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/TransactionsStatus.java @@ -0,0 +1,373 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.time.LocalDate; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Status of account transaction sync + */ +@ApiModel(description = "Status of account transaction sync")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class TransactionsStatus { + public static final String SERIALIZED_NAME_INITIAL_SYNC_COMPLETED = "initial_sync_completed"; + @SerializedName(SERIALIZED_NAME_INITIAL_SYNC_COMPLETED) + private Boolean initialSyncCompleted; + + public static final String SERIALIZED_NAME_LAST_SUCCESSFUL_SYNC = "last_successful_sync"; + @SerializedName(SERIALIZED_NAME_LAST_SUCCESSFUL_SYNC) + private LocalDate lastSuccessfulSync; + + public static final String SERIALIZED_NAME_FIRST_TRANSACTION_DATE = "first_transaction_date"; + @SerializedName(SERIALIZED_NAME_FIRST_TRANSACTION_DATE) + private LocalDate firstTransactionDate; + + public TransactionsStatus() { + } + + public TransactionsStatus initialSyncCompleted(Boolean initialSyncCompleted) { + + + + + this.initialSyncCompleted = initialSyncCompleted; + return this; + } + + /** + * Get initialSyncCompleted + * @return initialSyncCompleted + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Boolean getInitialSyncCompleted() { + return initialSyncCompleted; + } + + + public void setInitialSyncCompleted(Boolean initialSyncCompleted) { + + + + this.initialSyncCompleted = initialSyncCompleted; + } + + + public TransactionsStatus lastSuccessfulSync(LocalDate lastSuccessfulSync) { + + + + + this.lastSuccessfulSync = lastSuccessfulSync; + return this; + } + + /** + * Date in YYYY-MM-DD format or null + * @return lastSuccessfulSync + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Sun Jan 23 16:00:00 PST 2022", value = "Date in YYYY-MM-DD format or null") + + public LocalDate getLastSuccessfulSync() { + return lastSuccessfulSync; + } + + + public void setLastSuccessfulSync(LocalDate lastSuccessfulSync) { + + + + this.lastSuccessfulSync = lastSuccessfulSync; + } + + + public TransactionsStatus firstTransactionDate(LocalDate firstTransactionDate) { + + + + + this.firstTransactionDate = firstTransactionDate; + return this; + } + + /** + * Date in YYYY-MM-DD format or null + * @return firstTransactionDate + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Sun Jan 23 16:00:00 PST 2022", value = "Date in YYYY-MM-DD format or null") + + public LocalDate getFirstTransactionDate() { + return firstTransactionDate; + } + + + public void setFirstTransactionDate(LocalDate firstTransactionDate) { + + + + this.firstTransactionDate = firstTransactionDate; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TransactionsStatus instance itself + */ + public TransactionsStatus putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TransactionsStatus transactionsStatus = (TransactionsStatus) o; + return Objects.equals(this.initialSyncCompleted, transactionsStatus.initialSyncCompleted) && + Objects.equals(this.lastSuccessfulSync, transactionsStatus.lastSuccessfulSync) && + Objects.equals(this.firstTransactionDate, transactionsStatus.firstTransactionDate)&& + Objects.equals(this.additionalProperties, transactionsStatus.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(initialSyncCompleted, lastSuccessfulSync, firstTransactionDate, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TransactionsStatus {\n"); + sb.append(" initialSyncCompleted: ").append(toIndentedString(initialSyncCompleted)).append("\n"); + sb.append(" lastSuccessfulSync: ").append(toIndentedString(lastSuccessfulSync)).append("\n"); + sb.append(" firstTransactionDate: ").append(toIndentedString(firstTransactionDate)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("initial_sync_completed"); + openapiFields.add("last_successful_sync"); + openapiFields.add("first_transaction_date"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to TransactionsStatus + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!TransactionsStatus.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TransactionsStatus is not found in the empty JSON string", TransactionsStatus.openapiRequiredFields.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TransactionsStatus.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TransactionsStatus' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TransactionsStatus.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TransactionsStatus value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public TransactionsStatus read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + TransactionsStatus instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TransactionsStatus given an JSON string + * + * @param jsonString JSON string + * @return An instance of TransactionsStatus + * @throws IOException if the JSON string is invalid with respect to TransactionsStatus + */ + public static TransactionsStatus fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TransactionsStatus.class); + } + + /** + * Convert an instance of TransactionsStatus to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/USExchange.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/USExchange.java new file mode 100644 index 0000000000..1b8eaa3eec --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/USExchange.java @@ -0,0 +1,613 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * US Stock Exchange + */ +@ApiModel(description = "US Stock Exchange")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class USExchange { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private UUID id; + + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + private String code; + + public static final String SERIALIZED_NAME_MIC_CODE = "mic_code"; + @SerializedName(SERIALIZED_NAME_MIC_CODE) + private String micCode; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_TIMEZONE = "timezone"; + @SerializedName(SERIALIZED_NAME_TIMEZONE) + private String timezone; + + public static final String SERIALIZED_NAME_START_TIME = "start_time"; + @SerializedName(SERIALIZED_NAME_START_TIME) + private String startTime; + + public static final String SERIALIZED_NAME_CLOSE_TIME = "close_time"; + @SerializedName(SERIALIZED_NAME_CLOSE_TIME) + private String closeTime; + + public static final String SERIALIZED_NAME_SUFFIX = "suffix"; + @SerializedName(SERIALIZED_NAME_SUFFIX) + private String suffix; + + public static final String SERIALIZED_NAME_ALLOWS_CRYPTOCURRENCY_SYMBOLS = "allows_cryptocurrency_symbols"; + @SerializedName(SERIALIZED_NAME_ALLOWS_CRYPTOCURRENCY_SYMBOLS) + private Boolean allowsCryptocurrencySymbols; + + public USExchange() { + } + + public USExchange id(UUID id) { + + + + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getId() { + return id; + } + + + public void setId(UUID id) { + + + + this.id = id; + } + + + public USExchange code(String code) { + + + + + this.code = code; + return this; + } + + /** + * Get code + * @return code + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "ARCX", value = "") + + public String getCode() { + return code; + } + + + public void setCode(String code) { + + + + this.code = code; + } + + + public USExchange micCode(String micCode) { + + + + + this.micCode = micCode; + return this; + } + + /** + * Get micCode + * @return micCode + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "ARCA", value = "") + + public String getMicCode() { + return micCode; + } + + + public void setMicCode(String micCode) { + + + + this.micCode = micCode; + } + + + public USExchange name(String name) { + + + + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "NYSE ARCA", value = "") + + public String getName() { + return name; + } + + + public void setName(String name) { + + + + this.name = name; + } + + + public USExchange timezone(String timezone) { + + + + + this.timezone = timezone; + return this; + } + + /** + * Get timezone + * @return timezone + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "America/New_York", value = "") + + public String getTimezone() { + return timezone; + } + + + public void setTimezone(String timezone) { + + + + this.timezone = timezone; + } + + + public USExchange startTime(String startTime) { + + + + + this.startTime = startTime; + return this; + } + + /** + * Get startTime + * @return startTime + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "09:30:00", value = "") + + public String getStartTime() { + return startTime; + } + + + public void setStartTime(String startTime) { + + + + this.startTime = startTime; + } + + + public USExchange closeTime(String closeTime) { + + + + + this.closeTime = closeTime; + return this; + } + + /** + * Get closeTime + * @return closeTime + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "57600", value = "") + + public String getCloseTime() { + return closeTime; + } + + + public void setCloseTime(String closeTime) { + + + + this.closeTime = closeTime; + } + + + public USExchange suffix(String suffix) { + + + + + this.suffix = suffix; + return this; + } + + /** + * Get suffix + * @return suffix + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "None", value = "") + + public String getSuffix() { + return suffix; + } + + + public void setSuffix(String suffix) { + + + + this.suffix = suffix; + } + + + public USExchange allowsCryptocurrencySymbols(Boolean allowsCryptocurrencySymbols) { + + + + + this.allowsCryptocurrencySymbols = allowsCryptocurrencySymbols; + return this; + } + + /** + * Get allowsCryptocurrencySymbols + * @return allowsCryptocurrencySymbols + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "false", value = "") + + public Boolean getAllowsCryptocurrencySymbols() { + return allowsCryptocurrencySymbols; + } + + + public void setAllowsCryptocurrencySymbols(Boolean allowsCryptocurrencySymbols) { + + + + this.allowsCryptocurrencySymbols = allowsCryptocurrencySymbols; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the USExchange instance itself + */ + public USExchange putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + USExchange usExchange = (USExchange) o; + return Objects.equals(this.id, usExchange.id) && + Objects.equals(this.code, usExchange.code) && + Objects.equals(this.micCode, usExchange.micCode) && + Objects.equals(this.name, usExchange.name) && + Objects.equals(this.timezone, usExchange.timezone) && + Objects.equals(this.startTime, usExchange.startTime) && + Objects.equals(this.closeTime, usExchange.closeTime) && + Objects.equals(this.suffix, usExchange.suffix) && + Objects.equals(this.allowsCryptocurrencySymbols, usExchange.allowsCryptocurrencySymbols)&& + Objects.equals(this.additionalProperties, usExchange.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, code, micCode, name, timezone, startTime, closeTime, suffix, allowsCryptocurrencySymbols, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class USExchange {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" micCode: ").append(toIndentedString(micCode)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" timezone: ").append(toIndentedString(timezone)).append("\n"); + sb.append(" startTime: ").append(toIndentedString(startTime)).append("\n"); + sb.append(" closeTime: ").append(toIndentedString(closeTime)).append("\n"); + sb.append(" suffix: ").append(toIndentedString(suffix)).append("\n"); + sb.append(" allowsCryptocurrencySymbols: ").append(toIndentedString(allowsCryptocurrencySymbols)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("code"); + openapiFields.add("mic_code"); + openapiFields.add("name"); + openapiFields.add("timezone"); + openapiFields.add("start_time"); + openapiFields.add("close_time"); + openapiFields.add("suffix"); + openapiFields.add("allows_cryptocurrency_symbols"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to USExchange + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!USExchange.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in USExchange is not found in the empty JSON string", USExchange.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); + } + if ((jsonObj.get("mic_code") != null && !jsonObj.get("mic_code").isJsonNull()) && !jsonObj.get("mic_code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `mic_code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("mic_code").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("timezone") != null && !jsonObj.get("timezone").isJsonNull()) && !jsonObj.get("timezone").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `timezone` to be a primitive type in the JSON string but got `%s`", jsonObj.get("timezone").toString())); + } + if ((jsonObj.get("start_time") != null && !jsonObj.get("start_time").isJsonNull()) && !jsonObj.get("start_time").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `start_time` to be a primitive type in the JSON string but got `%s`", jsonObj.get("start_time").toString())); + } + if ((jsonObj.get("close_time") != null && !jsonObj.get("close_time").isJsonNull()) && !jsonObj.get("close_time").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `close_time` to be a primitive type in the JSON string but got `%s`", jsonObj.get("close_time").toString())); + } + if (!jsonObj.get("suffix").isJsonNull() && (jsonObj.get("suffix") != null && !jsonObj.get("suffix").isJsonNull()) && !jsonObj.get("suffix").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `suffix` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suffix").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!USExchange.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'USExchange' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(USExchange.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, USExchange value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public USExchange read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + USExchange instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of USExchange given an JSON string + * + * @param jsonString JSON string + * @return An instance of USExchange + * @throws IOException if the JSON string is invalid with respect to USExchange + */ + public static USExchange fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, USExchange.class); + } + + /** + * Convert an instance of USExchange to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/UnderlyingSymbol.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/UnderlyingSymbol.java new file mode 100644 index 0000000000..531ce59468 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/UnderlyingSymbol.java @@ -0,0 +1,645 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.Currency; +import com.konfigthis.client.model.FigiInstrumentNullable; +import com.konfigthis.client.model.SecurityType; +import com.konfigthis.client.model.USExchange; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Underlying Symbol + */ +@ApiModel(description = "Underlying Symbol")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class UnderlyingSymbol { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private UUID id; + + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + @SerializedName(SERIALIZED_NAME_SYMBOL) + private String symbol; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + private Currency currency; + + public static final String SERIALIZED_NAME_EXCHANGE = "exchange"; + @SerializedName(SERIALIZED_NAME_EXCHANGE) + private USExchange exchange; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private SecurityType type; + + public static final String SERIALIZED_NAME_CURRENCIES = "currencies"; + @SerializedName(SERIALIZED_NAME_CURRENCIES) + private List currencies = null; + + public static final String SERIALIZED_NAME_FIGI_CODE = "figi_code"; + @SerializedName(SERIALIZED_NAME_FIGI_CODE) + private String figiCode; + + public static final String SERIALIZED_NAME_FIGI_INSTRUMENT = "figi_instrument"; + @SerializedName(SERIALIZED_NAME_FIGI_INSTRUMENT) + private FigiInstrumentNullable figiInstrument; + + public UnderlyingSymbol() { + } + + public UnderlyingSymbol id(UUID id) { + + + + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", value = "") + + public UUID getId() { + return id; + } + + + public void setId(UUID id) { + + + + this.id = id; + } + + + public UnderlyingSymbol symbol(String symbol) { + + + + + this.symbol = symbol; + return this; + } + + /** + * Get symbol + * @return symbol + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "SPY", value = "") + + public String getSymbol() { + return symbol; + } + + + public void setSymbol(String symbol) { + + + + this.symbol = symbol; + } + + + public UnderlyingSymbol description(String description) { + + + + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "SPDR S&P 500 ETF Trust", value = "") + + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + + + + this.description = description; + } + + + public UnderlyingSymbol currency(Currency currency) { + + + + + this.currency = currency; + return this; + } + + /** + * Get currency + * @return currency + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Currency getCurrency() { + return currency; + } + + + public void setCurrency(Currency currency) { + + + + this.currency = currency; + } + + + public UnderlyingSymbol exchange(USExchange exchange) { + + + + + this.exchange = exchange; + return this; + } + + /** + * Get exchange + * @return exchange + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public USExchange getExchange() { + return exchange; + } + + + public void setExchange(USExchange exchange) { + + + + this.exchange = exchange; + } + + + public UnderlyingSymbol type(SecurityType type) { + + + + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public SecurityType getType() { + return type; + } + + + public void setType(SecurityType type) { + + + + this.type = type; + } + + + public UnderlyingSymbol currencies(List currencies) { + + + + + this.currencies = currencies; + return this; + } + + public UnderlyingSymbol addCurrenciesItem(Currency currenciesItem) { + if (this.currencies == null) { + this.currencies = new ArrayList<>(); + } + this.currencies.add(currenciesItem); + return this; + } + + /** + * Get currencies + * @return currencies + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public List getCurrencies() { + return currencies; + } + + + public void setCurrencies(List currencies) { + + + + this.currencies = currencies; + } + + + public UnderlyingSymbol figiCode(String figiCode) { + + + + + this.figiCode = figiCode; + return this; + } + + /** + * Get figiCode + * @return figiCode + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "BBG000B9XRY4", value = "") + + public String getFigiCode() { + return figiCode; + } + + + public void setFigiCode(String figiCode) { + + + + this.figiCode = figiCode; + } + + + public UnderlyingSymbol figiInstrument(FigiInstrumentNullable figiInstrument) { + + + + + this.figiInstrument = figiInstrument; + return this; + } + + /** + * Get figiInstrument + * @return figiInstrument + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public FigiInstrumentNullable getFigiInstrument() { + return figiInstrument; + } + + + public void setFigiInstrument(FigiInstrumentNullable figiInstrument) { + + + + this.figiInstrument = figiInstrument; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UnderlyingSymbol instance itself + */ + public UnderlyingSymbol putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnderlyingSymbol underlyingSymbol = (UnderlyingSymbol) o; + return Objects.equals(this.id, underlyingSymbol.id) && + Objects.equals(this.symbol, underlyingSymbol.symbol) && + Objects.equals(this.description, underlyingSymbol.description) && + Objects.equals(this.currency, underlyingSymbol.currency) && + Objects.equals(this.exchange, underlyingSymbol.exchange) && + Objects.equals(this.type, underlyingSymbol.type) && + Objects.equals(this.currencies, underlyingSymbol.currencies) && + Objects.equals(this.figiCode, underlyingSymbol.figiCode) && + Objects.equals(this.figiInstrument, underlyingSymbol.figiInstrument)&& + Objects.equals(this.additionalProperties, underlyingSymbol.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, symbol, description, currency, exchange, type, currencies, figiCode, figiInstrument, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnderlyingSymbol {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append(" exchange: ").append(toIndentedString(exchange)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" currencies: ").append(toIndentedString(currencies)).append("\n"); + sb.append(" figiCode: ").append(toIndentedString(figiCode)).append("\n"); + sb.append(" figiInstrument: ").append(toIndentedString(figiInstrument)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("symbol"); + openapiFields.add("description"); + openapiFields.add("currency"); + openapiFields.add("exchange"); + openapiFields.add("type"); + openapiFields.add("currencies"); + openapiFields.add("figi_code"); + openapiFields.add("figi_instrument"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to UnderlyingSymbol + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!UnderlyingSymbol.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnderlyingSymbol is not found in the empty JSON string", UnderlyingSymbol.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("symbol") != null && !jsonObj.get("symbol").isJsonNull()) && !jsonObj.get("symbol").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `symbol` to be a primitive type in the JSON string but got `%s`", jsonObj.get("symbol").toString())); + } + if (!jsonObj.get("description").isJsonNull() && (jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + // validate the optional field `currency` + if (jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) { + Currency.validateJsonObject(jsonObj.getAsJsonObject("currency")); + } + // validate the optional field `exchange` + if (jsonObj.get("exchange") != null && !jsonObj.get("exchange").isJsonNull()) { + USExchange.validateJsonObject(jsonObj.getAsJsonObject("exchange")); + } + // validate the optional field `type` + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) { + SecurityType.validateJsonObject(jsonObj.getAsJsonObject("type")); + } + if (jsonObj.get("currencies") != null && !jsonObj.get("currencies").isJsonNull()) { + JsonArray jsonArraycurrencies = jsonObj.getAsJsonArray("currencies"); + if (jsonArraycurrencies != null) { + // ensure the json data is an array + if (!jsonObj.get("currencies").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `currencies` to be an array in the JSON string but got `%s`", jsonObj.get("currencies").toString())); + } + + // validate the optional field `currencies` (array) + for (int i = 0; i < jsonArraycurrencies.size(); i++) { + Currency.validateJsonObject(jsonArraycurrencies.get(i).getAsJsonObject()); + }; + } + } + if (!jsonObj.get("figi_code").isJsonNull() && (jsonObj.get("figi_code") != null && !jsonObj.get("figi_code").isJsonNull()) && !jsonObj.get("figi_code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `figi_code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("figi_code").toString())); + } + // validate the optional field `figi_instrument` + if (jsonObj.get("figi_instrument") != null && !jsonObj.get("figi_instrument").isJsonNull()) { + FigiInstrumentNullable.validateJsonObject(jsonObj.getAsJsonObject("figi_instrument")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnderlyingSymbol.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnderlyingSymbol' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnderlyingSymbol.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnderlyingSymbol value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public UnderlyingSymbol read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + UnderlyingSymbol instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnderlyingSymbol given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnderlyingSymbol + * @throws IOException if the JSON string is invalid with respect to UnderlyingSymbol + */ + public static UnderlyingSymbol fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnderlyingSymbol.class); + } + + /** + * Convert an instance of UnderlyingSymbol to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/UniversalActivity.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/UniversalActivity.java new file mode 100644 index 0000000000..163656710a --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/UniversalActivity.java @@ -0,0 +1,965 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.AccountSimple; +import com.konfigthis.client.model.Currency; +import com.konfigthis.client.model.OptionsSymbol; +import com.konfigthis.client.model.Symbol; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * A transaction or activity from an institution + */ +@ApiModel(description = "A transaction or activity from an institution")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class UniversalActivity { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_ACCOUNT = "account"; + @SerializedName(SERIALIZED_NAME_ACCOUNT) + private AccountSimple account; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + private Double amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + private Currency currency; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_FEE = "fee"; + @SerializedName(SERIALIZED_NAME_FEE) + private Double fee; + + public static final String SERIALIZED_NAME_FX_RATE = "fx_rate"; + @SerializedName(SERIALIZED_NAME_FX_RATE) + private Double fxRate; + + public static final String SERIALIZED_NAME_INSTITUTION = "institution"; + @SerializedName(SERIALIZED_NAME_INSTITUTION) + private String institution; + + public static final String SERIALIZED_NAME_OPTION_TYPE = "option_type"; + @SerializedName(SERIALIZED_NAME_OPTION_TYPE) + private String optionType; + + public static final String SERIALIZED_NAME_PRICE = "price"; + @SerializedName(SERIALIZED_NAME_PRICE) + private Double price; + + public static final String SERIALIZED_NAME_SETTLEMENT_DATE = "settlement_date"; + @SerializedName(SERIALIZED_NAME_SETTLEMENT_DATE) + private String settlementDate; + + public static final String SERIALIZED_NAME_EXTERNAL_REFERENCE_ID = "external_reference_id"; + @SerializedName(SERIALIZED_NAME_EXTERNAL_REFERENCE_ID) + private String externalReferenceId; + + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + @SerializedName(SERIALIZED_NAME_SYMBOL) + private Symbol symbol; + + public static final String SERIALIZED_NAME_OPTION_SYMBOL = "option_symbol"; + @SerializedName(SERIALIZED_NAME_OPTION_SYMBOL) + private OptionsSymbol optionSymbol; + + public static final String SERIALIZED_NAME_TRADE_DATE = "trade_date"; + @SerializedName(SERIALIZED_NAME_TRADE_DATE) + private String tradeDate; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type; + + public static final String SERIALIZED_NAME_UNITS = "units"; + @SerializedName(SERIALIZED_NAME_UNITS) + private Double units; + + public UniversalActivity() { + } + + public UniversalActivity id(String id) { + + + + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2f7dc9b3-5c33-4668-3440-2b31e056ebe6", value = "") + + public String getId() { + return id; + } + + + public void setId(String id) { + + + + this.id = id; + } + + + public UniversalActivity account(AccountSimple account) { + + + + + this.account = account; + return this; + } + + /** + * Get account + * @return account + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public AccountSimple getAccount() { + return account; + } + + + public void setAccount(AccountSimple account) { + + + + this.account = account; + } + + + public UniversalActivity amount(Double amount) { + + + + + this.amount = amount; + return this; + } + + public UniversalActivity amount(Integer amount) { + + + + + this.amount = amount.doubleValue(); + return this; + } + + /** + * Get amount + * @return amount + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "263.82", value = "") + + public Double getAmount() { + return amount; + } + + + public void setAmount(Double amount) { + + + + this.amount = amount; + } + + + public UniversalActivity currency(Currency currency) { + + + + + this.currency = currency; + return this; + } + + /** + * Get currency + * @return currency + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Currency getCurrency() { + return currency; + } + + + public void setCurrency(Currency currency) { + + + + this.currency = currency; + } + + + public UniversalActivity description(String description) { + + + + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "WALT DISNEY UNIT DIST ON 21 SHS REC 12/31/21 PAY 01/06/22", value = "") + + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + + + + this.description = description; + } + + + public UniversalActivity fee(Double fee) { + + + + + this.fee = fee; + return this; + } + + public UniversalActivity fee(Integer fee) { + + + + + this.fee = fee.doubleValue(); + return this; + } + + /** + * Get fee + * @return fee + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "0", value = "") + + public Double getFee() { + return fee; + } + + + public void setFee(Double fee) { + + + + this.fee = fee; + } + + + public UniversalActivity fxRate(Double fxRate) { + + + + + this.fxRate = fxRate; + return this; + } + + public UniversalActivity fxRate(Integer fxRate) { + + + + + this.fxRate = fxRate.doubleValue(); + return this; + } + + /** + * The forex conversion rate involved in the transaction if provided by the brokerage. Used in cases where securities of one currency are purchased in a different currency, and the forex conversion is automatic. In those cases, price, amount and fee will be in the top level currency (activity -> currency) + * @return fxRate + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "1.032", value = "The forex conversion rate involved in the transaction if provided by the brokerage. Used in cases where securities of one currency are purchased in a different currency, and the forex conversion is automatic. In those cases, price, amount and fee will be in the top level currency (activity -> currency)") + + public Double getFxRate() { + return fxRate; + } + + + public void setFxRate(Double fxRate) { + + + + this.fxRate = fxRate; + } + + + public UniversalActivity institution(String institution) { + + + + + this.institution = institution; + return this; + } + + /** + * Get institution + * @return institution + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "SnapTrade Investr", value = "") + + public String getInstitution() { + return institution; + } + + + public void setInstitution(String institution) { + + + + this.institution = institution; + } + + + public UniversalActivity optionType(String optionType) { + + + + + this.optionType = optionType; + return this; + } + + /** + * If an option transaction, then it's type (BUY_TO_OPEN, SELL_TO_CLOSE, etc), otherwise empty string + * @return optionType + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "BUY_TO_OPEN", value = "If an option transaction, then it's type (BUY_TO_OPEN, SELL_TO_CLOSE, etc), otherwise empty string") + + public String getOptionType() { + return optionType; + } + + + public void setOptionType(String optionType) { + + + + this.optionType = optionType; + } + + + public UniversalActivity price(Double price) { + + + + + this.price = price; + return this; + } + + public UniversalActivity price(Integer price) { + + + + + this.price = price.doubleValue(); + return this; + } + + /** + * Get price + * @return price + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "0.4", value = "") + + public Double getPrice() { + return price; + } + + + public void setPrice(Double price) { + + + + this.price = price; + } + + + public UniversalActivity settlementDate(String settlementDate) { + + + + + this.settlementDate = settlementDate; + return this; + } + + /** + * Get settlementDate + * @return settlementDate + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2022-01-06T05:00:00.000Z", value = "") + + public String getSettlementDate() { + return settlementDate; + } + + + public void setSettlementDate(String settlementDate) { + + + + this.settlementDate = settlementDate; + } + + + public UniversalActivity externalReferenceId(String externalReferenceId) { + + + + + this.externalReferenceId = externalReferenceId; + return this; + } + + /** + * Reference ID from brokerage used to identify related transactions. For example if an order comprises of several transactions (buy, fee, fx), they can be grouped if they share the same external_reference_id + * @return externalReferenceId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2f7dc9b3-5c33-4668-3440-2b31e056ebe6", value = "Reference ID from brokerage used to identify related transactions. For example if an order comprises of several transactions (buy, fee, fx), they can be grouped if they share the same external_reference_id") + + public String getExternalReferenceId() { + return externalReferenceId; + } + + + public void setExternalReferenceId(String externalReferenceId) { + + + + this.externalReferenceId = externalReferenceId; + } + + + public UniversalActivity symbol(Symbol symbol) { + + + + + this.symbol = symbol; + return this; + } + + /** + * Get symbol + * @return symbol + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Symbol getSymbol() { + return symbol; + } + + + public void setSymbol(Symbol symbol) { + + + + this.symbol = symbol; + } + + + public UniversalActivity optionSymbol(OptionsSymbol optionSymbol) { + + + + + this.optionSymbol = optionSymbol; + return this; + } + + /** + * Get optionSymbol + * @return optionSymbol + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public OptionsSymbol getOptionSymbol() { + return optionSymbol; + } + + + public void setOptionSymbol(OptionsSymbol optionSymbol) { + + + + this.optionSymbol = optionSymbol; + } + + + public UniversalActivity tradeDate(String tradeDate) { + + + + + this.tradeDate = tradeDate; + return this; + } + + /** + * Get tradeDate + * @return tradeDate + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2022-01-06T05:00:00.000Z", value = "") + + public String getTradeDate() { + return tradeDate; + } + + + public void setTradeDate(String tradeDate) { + + + + this.tradeDate = tradeDate; + } + + + public UniversalActivity type(String type) { + + + + + this.type = type; + return this; + } + + /** + * Potential values include (but are not limited to) - DIVIDEND - BUY - SELL - CONTRIBUTION - WITHDRAWAL - EXTERNAL_ASSET_TRANSFER_IN - EXTERNAL_ASSET_TRANSFER_OUT - INTERNAL_CASH_TRANSFER_IN - INTERNAL_CASH_TRANSFER_OUT - INTERNAL_ASSET_TRANSFER_IN - INTERNAL_ASSET_TRANSFER_OUT - INTEREST - REBATE - GOV_GRANT - TAX - FEE - REI - FXT + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Potential values include (but are not limited to) - DIVIDEND - BUY - SELL - CONTRIBUTION - WITHDRAWAL - EXTERNAL_ASSET_TRANSFER_IN - EXTERNAL_ASSET_TRANSFER_OUT - INTERNAL_CASH_TRANSFER_IN - INTERNAL_CASH_TRANSFER_OUT - INTERNAL_ASSET_TRANSFER_IN - INTERNAL_ASSET_TRANSFER_OUT - INTEREST - REBATE - GOV_GRANT - TAX - FEE - REI - FXT") + + public String getType() { + return type; + } + + + public void setType(String type) { + + + + this.type = type; + } + + + public UniversalActivity units(Double units) { + + + + + this.units = units; + return this; + } + + public UniversalActivity units(Integer units) { + + + + + this.units = units.doubleValue(); + return this; + } + + /** + * Usually but not necessarily an integer + * @return units + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "5", value = "Usually but not necessarily an integer") + + public Double getUnits() { + return units; + } + + + public void setUnits(Double units) { + + + + this.units = units; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UniversalActivity instance itself + */ + public UniversalActivity putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UniversalActivity universalActivity = (UniversalActivity) o; + return Objects.equals(this.id, universalActivity.id) && + Objects.equals(this.account, universalActivity.account) && + Objects.equals(this.amount, universalActivity.amount) && + Objects.equals(this.currency, universalActivity.currency) && + Objects.equals(this.description, universalActivity.description) && + Objects.equals(this.fee, universalActivity.fee) && + Objects.equals(this.fxRate, universalActivity.fxRate) && + Objects.equals(this.institution, universalActivity.institution) && + Objects.equals(this.optionType, universalActivity.optionType) && + Objects.equals(this.price, universalActivity.price) && + Objects.equals(this.settlementDate, universalActivity.settlementDate) && + Objects.equals(this.externalReferenceId, universalActivity.externalReferenceId) && + Objects.equals(this.symbol, universalActivity.symbol) && + Objects.equals(this.optionSymbol, universalActivity.optionSymbol) && + Objects.equals(this.tradeDate, universalActivity.tradeDate) && + Objects.equals(this.type, universalActivity.type) && + Objects.equals(this.units, universalActivity.units)&& + Objects.equals(this.additionalProperties, universalActivity.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, account, amount, currency, description, fee, fxRate, institution, optionType, price, settlementDate, externalReferenceId, symbol, optionSymbol, tradeDate, type, units, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UniversalActivity {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" account: ").append(toIndentedString(account)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" fee: ").append(toIndentedString(fee)).append("\n"); + sb.append(" fxRate: ").append(toIndentedString(fxRate)).append("\n"); + sb.append(" institution: ").append(toIndentedString(institution)).append("\n"); + sb.append(" optionType: ").append(toIndentedString(optionType)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append(" settlementDate: ").append(toIndentedString(settlementDate)).append("\n"); + sb.append(" externalReferenceId: ").append(toIndentedString(externalReferenceId)).append("\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" optionSymbol: ").append(toIndentedString(optionSymbol)).append("\n"); + sb.append(" tradeDate: ").append(toIndentedString(tradeDate)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" units: ").append(toIndentedString(units)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("account"); + openapiFields.add("amount"); + openapiFields.add("currency"); + openapiFields.add("description"); + openapiFields.add("fee"); + openapiFields.add("fx_rate"); + openapiFields.add("institution"); + openapiFields.add("option_type"); + openapiFields.add("price"); + openapiFields.add("settlement_date"); + openapiFields.add("external_reference_id"); + openapiFields.add("symbol"); + openapiFields.add("option_symbol"); + openapiFields.add("trade_date"); + openapiFields.add("type"); + openapiFields.add("units"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to UniversalActivity + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!UniversalActivity.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UniversalActivity is not found in the empty JSON string", UniversalActivity.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `account` + if (jsonObj.get("account") != null && !jsonObj.get("account").isJsonNull()) { + AccountSimple.validateJsonObject(jsonObj.getAsJsonObject("account")); + } + // validate the optional field `currency` + if (jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) { + Currency.validateJsonObject(jsonObj.getAsJsonObject("currency")); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if ((jsonObj.get("institution") != null && !jsonObj.get("institution").isJsonNull()) && !jsonObj.get("institution").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `institution` to be a primitive type in the JSON string but got `%s`", jsonObj.get("institution").toString())); + } + if ((jsonObj.get("option_type") != null && !jsonObj.get("option_type").isJsonNull()) && !jsonObj.get("option_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `option_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("option_type").toString())); + } + if ((jsonObj.get("settlement_date") != null && !jsonObj.get("settlement_date").isJsonNull()) && !jsonObj.get("settlement_date").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `settlement_date` to be a primitive type in the JSON string but got `%s`", jsonObj.get("settlement_date").toString())); + } + if (!jsonObj.get("external_reference_id").isJsonNull() && (jsonObj.get("external_reference_id") != null && !jsonObj.get("external_reference_id").isJsonNull()) && !jsonObj.get("external_reference_id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `external_reference_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("external_reference_id").toString())); + } + // validate the optional field `symbol` + if (jsonObj.get("symbol") != null && !jsonObj.get("symbol").isJsonNull()) { + Symbol.validateJsonObject(jsonObj.getAsJsonObject("symbol")); + } + // validate the optional field `option_symbol` + if (jsonObj.get("option_symbol") != null && !jsonObj.get("option_symbol").isJsonNull()) { + OptionsSymbol.validateJsonObject(jsonObj.getAsJsonObject("option_symbol")); + } + if (!jsonObj.get("trade_date").isJsonNull() && (jsonObj.get("trade_date") != null && !jsonObj.get("trade_date").isJsonNull()) && !jsonObj.get("trade_date").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `trade_date` to be a primitive type in the JSON string but got `%s`", jsonObj.get("trade_date").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UniversalActivity.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UniversalActivity' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UniversalActivity.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UniversalActivity value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public UniversalActivity read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + UniversalActivity instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UniversalActivity given an JSON string + * + * @param jsonString JSON string + * @return An instance of UniversalActivity + * @throws IOException if the JSON string is invalid with respect to UniversalActivity + */ + public static UniversalActivity fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UniversalActivity.class); + } + + /** + * Convert an instance of UniversalActivity to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/UniversalSymbol.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/UniversalSymbol.java new file mode 100644 index 0000000000..0d1be47804 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/UniversalSymbol.java @@ -0,0 +1,686 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.Currency; +import com.konfigthis.client.model.Exchange; +import com.konfigthis.client.model.FigiInstrumentNullable; +import com.konfigthis.client.model.SecurityType; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Universal symbol + */ +@ApiModel(description = "Universal symbol")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class UniversalSymbol { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private UUID id; + + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + @SerializedName(SERIALIZED_NAME_SYMBOL) + private String symbol; + + public static final String SERIALIZED_NAME_RAW_SYMBOL = "raw_symbol"; + @SerializedName(SERIALIZED_NAME_RAW_SYMBOL) + private String rawSymbol; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + private Currency currency; + + public static final String SERIALIZED_NAME_EXCHANGE = "exchange"; + @SerializedName(SERIALIZED_NAME_EXCHANGE) + private Exchange exchange; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private SecurityType type; + + public static final String SERIALIZED_NAME_CURRENCIES = "currencies"; + @SerializedName(SERIALIZED_NAME_CURRENCIES) + private List currencies = new ArrayList<>(); + + public static final String SERIALIZED_NAME_FIGI_CODE = "figi_code"; + @SerializedName(SERIALIZED_NAME_FIGI_CODE) + private String figiCode; + + public static final String SERIALIZED_NAME_FIGI_INSTRUMENT = "figi_instrument"; + @SerializedName(SERIALIZED_NAME_FIGI_INSTRUMENT) + private FigiInstrumentNullable figiInstrument; + + public UniversalSymbol() { + } + + public UniversalSymbol id(UUID id) { + + + + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", required = true, value = "") + + public UUID getId() { + return id; + } + + + public void setId(UUID id) { + + + + this.id = id; + } + + + public UniversalSymbol symbol(String symbol) { + + + + + this.symbol = symbol; + return this; + } + + /** + * Get symbol + * @return symbol + **/ + @javax.annotation.Nonnull + @ApiModelProperty(example = "VAB.TO", required = true, value = "") + + public String getSymbol() { + return symbol; + } + + + public void setSymbol(String symbol) { + + + + this.symbol = symbol; + } + + + public UniversalSymbol rawSymbol(String rawSymbol) { + + + + + this.rawSymbol = rawSymbol; + return this; + } + + /** + * Get rawSymbol + * @return rawSymbol + **/ + @javax.annotation.Nonnull + @ApiModelProperty(example = "VAB", required = true, value = "") + + public String getRawSymbol() { + return rawSymbol; + } + + + public void setRawSymbol(String rawSymbol) { + + + + this.rawSymbol = rawSymbol; + } + + + public UniversalSymbol description(String description) { + + + + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "VANGUARD CDN AGGREGATE BOND INDEX ETF", value = "") + + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + + + + this.description = description; + } + + + public UniversalSymbol currency(Currency currency) { + + + + + this.currency = currency; + return this; + } + + /** + * Get currency + * @return currency + **/ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + + public Currency getCurrency() { + return currency; + } + + + public void setCurrency(Currency currency) { + + + + this.currency = currency; + } + + + public UniversalSymbol exchange(Exchange exchange) { + + + + + this.exchange = exchange; + return this; + } + + /** + * Get exchange + * @return exchange + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Exchange getExchange() { + return exchange; + } + + + public void setExchange(Exchange exchange) { + + + + this.exchange = exchange; + } + + + public UniversalSymbol type(SecurityType type) { + + + + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + + public SecurityType getType() { + return type; + } + + + public void setType(SecurityType type) { + + + + this.type = type; + } + + + public UniversalSymbol currencies(List currencies) { + + + + + this.currencies = currencies; + return this; + } + + public UniversalSymbol addCurrenciesItem(Currency currenciesItem) { + this.currencies.add(currenciesItem); + return this; + } + + /** + * Get currencies + * @return currencies + **/ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + + public List getCurrencies() { + return currencies; + } + + + public void setCurrencies(List currencies) { + + + + this.currencies = currencies; + } + + + public UniversalSymbol figiCode(String figiCode) { + + + + + this.figiCode = figiCode; + return this; + } + + /** + * Get figiCode + * @return figiCode + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "BBG000B9XRY4", value = "") + + public String getFigiCode() { + return figiCode; + } + + + public void setFigiCode(String figiCode) { + + + + this.figiCode = figiCode; + } + + + public UniversalSymbol figiInstrument(FigiInstrumentNullable figiInstrument) { + + + + + this.figiInstrument = figiInstrument; + return this; + } + + /** + * Get figiInstrument + * @return figiInstrument + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public FigiInstrumentNullable getFigiInstrument() { + return figiInstrument; + } + + + public void setFigiInstrument(FigiInstrumentNullable figiInstrument) { + + + + this.figiInstrument = figiInstrument; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UniversalSymbol instance itself + */ + public UniversalSymbol putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UniversalSymbol universalSymbol = (UniversalSymbol) o; + return Objects.equals(this.id, universalSymbol.id) && + Objects.equals(this.symbol, universalSymbol.symbol) && + Objects.equals(this.rawSymbol, universalSymbol.rawSymbol) && + Objects.equals(this.description, universalSymbol.description) && + Objects.equals(this.currency, universalSymbol.currency) && + Objects.equals(this.exchange, universalSymbol.exchange) && + Objects.equals(this.type, universalSymbol.type) && + Objects.equals(this.currencies, universalSymbol.currencies) && + Objects.equals(this.figiCode, universalSymbol.figiCode) && + Objects.equals(this.figiInstrument, universalSymbol.figiInstrument)&& + Objects.equals(this.additionalProperties, universalSymbol.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, symbol, rawSymbol, description, currency, exchange, type, currencies, figiCode, figiInstrument, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UniversalSymbol {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" rawSymbol: ").append(toIndentedString(rawSymbol)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append(" exchange: ").append(toIndentedString(exchange)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" currencies: ").append(toIndentedString(currencies)).append("\n"); + sb.append(" figiCode: ").append(toIndentedString(figiCode)).append("\n"); + sb.append(" figiInstrument: ").append(toIndentedString(figiInstrument)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("symbol"); + openapiFields.add("raw_symbol"); + openapiFields.add("description"); + openapiFields.add("currency"); + openapiFields.add("exchange"); + openapiFields.add("type"); + openapiFields.add("currencies"); + openapiFields.add("figi_code"); + openapiFields.add("figi_instrument"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("symbol"); + openapiRequiredFields.add("raw_symbol"); + openapiRequiredFields.add("currency"); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("currencies"); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to UniversalSymbol + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!UniversalSymbol.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UniversalSymbol is not found in the empty JSON string", UniversalSymbol.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UniversalSymbol.openapiRequiredFields) { + if (jsonObj.get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + } + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (!jsonObj.get("symbol").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `symbol` to be a primitive type in the JSON string but got `%s`", jsonObj.get("symbol").toString())); + } + if (!jsonObj.get("raw_symbol").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `raw_symbol` to be a primitive type in the JSON string but got `%s`", jsonObj.get("raw_symbol").toString())); + } + if (!jsonObj.get("description").isJsonNull() && (jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + // validate the required field `currency` + Currency.validateJsonObject(jsonObj.getAsJsonObject("currency")); + // validate the optional field `exchange` + if (jsonObj.get("exchange") != null && !jsonObj.get("exchange").isJsonNull()) { + Exchange.validateJsonObject(jsonObj.getAsJsonObject("exchange")); + } + // validate the required field `type` + SecurityType.validateJsonObject(jsonObj.getAsJsonObject("type")); + // ensure the json data is an array + if (!jsonObj.get("currencies").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `currencies` to be an array in the JSON string but got `%s`", jsonObj.get("currencies").toString())); + } + + JsonArray jsonArraycurrencies = jsonObj.getAsJsonArray("currencies"); + // validate the required field `currencies` (array) + for (int i = 0; i < jsonArraycurrencies.size(); i++) { + Currency.validateJsonObject(jsonArraycurrencies.get(i).getAsJsonObject()); + }; + if (!jsonObj.get("figi_code").isJsonNull() && (jsonObj.get("figi_code") != null && !jsonObj.get("figi_code").isJsonNull()) && !jsonObj.get("figi_code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `figi_code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("figi_code").toString())); + } + // validate the optional field `figi_instrument` + if (jsonObj.get("figi_instrument") != null && !jsonObj.get("figi_instrument").isJsonNull()) { + FigiInstrumentNullable.validateJsonObject(jsonObj.getAsJsonObject("figi_instrument")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UniversalSymbol.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UniversalSymbol' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UniversalSymbol.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UniversalSymbol value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public UniversalSymbol read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + UniversalSymbol instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UniversalSymbol given an JSON string + * + * @param jsonString JSON string + * @return An instance of UniversalSymbol + * @throws IOException if the JSON string is invalid with respect to UniversalSymbol + */ + public static UniversalSymbol fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UniversalSymbol.class); + } + + /** + * Convert an instance of UniversalSymbol to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/UniversalSymbolNullable.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/UniversalSymbolNullable.java new file mode 100644 index 0000000000..f75b05b120 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/UniversalSymbolNullable.java @@ -0,0 +1,686 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.Currency; +import com.konfigthis.client.model.Exchange; +import com.konfigthis.client.model.FigiInstrumentNullable; +import com.konfigthis.client.model.SecurityType; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Universal symbol + */ +@ApiModel(description = "Universal symbol")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class UniversalSymbolNullable { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private UUID id; + + public static final String SERIALIZED_NAME_SYMBOL = "symbol"; + @SerializedName(SERIALIZED_NAME_SYMBOL) + private String symbol; + + public static final String SERIALIZED_NAME_RAW_SYMBOL = "raw_symbol"; + @SerializedName(SERIALIZED_NAME_RAW_SYMBOL) + private String rawSymbol; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + private Currency currency; + + public static final String SERIALIZED_NAME_EXCHANGE = "exchange"; + @SerializedName(SERIALIZED_NAME_EXCHANGE) + private Exchange exchange; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private SecurityType type; + + public static final String SERIALIZED_NAME_CURRENCIES = "currencies"; + @SerializedName(SERIALIZED_NAME_CURRENCIES) + private List currencies = new ArrayList<>(); + + public static final String SERIALIZED_NAME_FIGI_CODE = "figi_code"; + @SerializedName(SERIALIZED_NAME_FIGI_CODE) + private String figiCode; + + public static final String SERIALIZED_NAME_FIGI_INSTRUMENT = "figi_instrument"; + @SerializedName(SERIALIZED_NAME_FIGI_INSTRUMENT) + private FigiInstrumentNullable figiInstrument; + + public UniversalSymbolNullable() { + } + + public UniversalSymbolNullable id(UUID id) { + + + + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + @ApiModelProperty(example = "2bcd7cc3-e922-4976-bce1-9858296801c3", required = true, value = "") + + public UUID getId() { + return id; + } + + + public void setId(UUID id) { + + + + this.id = id; + } + + + public UniversalSymbolNullable symbol(String symbol) { + + + + + this.symbol = symbol; + return this; + } + + /** + * Get symbol + * @return symbol + **/ + @javax.annotation.Nonnull + @ApiModelProperty(example = "VAB.TO", required = true, value = "") + + public String getSymbol() { + return symbol; + } + + + public void setSymbol(String symbol) { + + + + this.symbol = symbol; + } + + + public UniversalSymbolNullable rawSymbol(String rawSymbol) { + + + + + this.rawSymbol = rawSymbol; + return this; + } + + /** + * Get rawSymbol + * @return rawSymbol + **/ + @javax.annotation.Nonnull + @ApiModelProperty(example = "VAB", required = true, value = "") + + public String getRawSymbol() { + return rawSymbol; + } + + + public void setRawSymbol(String rawSymbol) { + + + + this.rawSymbol = rawSymbol; + } + + + public UniversalSymbolNullable description(String description) { + + + + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "VANGUARD CDN AGGREGATE BOND INDEX ETF", value = "") + + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + + + + this.description = description; + } + + + public UniversalSymbolNullable currency(Currency currency) { + + + + + this.currency = currency; + return this; + } + + /** + * Get currency + * @return currency + **/ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + + public Currency getCurrency() { + return currency; + } + + + public void setCurrency(Currency currency) { + + + + this.currency = currency; + } + + + public UniversalSymbolNullable exchange(Exchange exchange) { + + + + + this.exchange = exchange; + return this; + } + + /** + * Get exchange + * @return exchange + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Exchange getExchange() { + return exchange; + } + + + public void setExchange(Exchange exchange) { + + + + this.exchange = exchange; + } + + + public UniversalSymbolNullable type(SecurityType type) { + + + + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + + public SecurityType getType() { + return type; + } + + + public void setType(SecurityType type) { + + + + this.type = type; + } + + + public UniversalSymbolNullable currencies(List currencies) { + + + + + this.currencies = currencies; + return this; + } + + public UniversalSymbolNullable addCurrenciesItem(Currency currenciesItem) { + this.currencies.add(currenciesItem); + return this; + } + + /** + * Get currencies + * @return currencies + **/ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + + public List getCurrencies() { + return currencies; + } + + + public void setCurrencies(List currencies) { + + + + this.currencies = currencies; + } + + + public UniversalSymbolNullable figiCode(String figiCode) { + + + + + this.figiCode = figiCode; + return this; + } + + /** + * Get figiCode + * @return figiCode + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "BBG000B9XRY4", value = "") + + public String getFigiCode() { + return figiCode; + } + + + public void setFigiCode(String figiCode) { + + + + this.figiCode = figiCode; + } + + + public UniversalSymbolNullable figiInstrument(FigiInstrumentNullable figiInstrument) { + + + + + this.figiInstrument = figiInstrument; + return this; + } + + /** + * Get figiInstrument + * @return figiInstrument + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public FigiInstrumentNullable getFigiInstrument() { + return figiInstrument; + } + + + public void setFigiInstrument(FigiInstrumentNullable figiInstrument) { + + + + this.figiInstrument = figiInstrument; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UniversalSymbolNullable instance itself + */ + public UniversalSymbolNullable putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UniversalSymbolNullable universalSymbolNullable = (UniversalSymbolNullable) o; + return Objects.equals(this.id, universalSymbolNullable.id) && + Objects.equals(this.symbol, universalSymbolNullable.symbol) && + Objects.equals(this.rawSymbol, universalSymbolNullable.rawSymbol) && + Objects.equals(this.description, universalSymbolNullable.description) && + Objects.equals(this.currency, universalSymbolNullable.currency) && + Objects.equals(this.exchange, universalSymbolNullable.exchange) && + Objects.equals(this.type, universalSymbolNullable.type) && + Objects.equals(this.currencies, universalSymbolNullable.currencies) && + Objects.equals(this.figiCode, universalSymbolNullable.figiCode) && + Objects.equals(this.figiInstrument, universalSymbolNullable.figiInstrument)&& + Objects.equals(this.additionalProperties, universalSymbolNullable.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, symbol, rawSymbol, description, currency, exchange, type, currencies, figiCode, figiInstrument, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UniversalSymbolNullable {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" symbol: ").append(toIndentedString(symbol)).append("\n"); + sb.append(" rawSymbol: ").append(toIndentedString(rawSymbol)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append(" exchange: ").append(toIndentedString(exchange)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" currencies: ").append(toIndentedString(currencies)).append("\n"); + sb.append(" figiCode: ").append(toIndentedString(figiCode)).append("\n"); + sb.append(" figiInstrument: ").append(toIndentedString(figiInstrument)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("symbol"); + openapiFields.add("raw_symbol"); + openapiFields.add("description"); + openapiFields.add("currency"); + openapiFields.add("exchange"); + openapiFields.add("type"); + openapiFields.add("currencies"); + openapiFields.add("figi_code"); + openapiFields.add("figi_instrument"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("symbol"); + openapiRequiredFields.add("raw_symbol"); + openapiRequiredFields.add("currency"); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("currencies"); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to UniversalSymbolNullable + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!UniversalSymbolNullable.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UniversalSymbolNullable is not found in the empty JSON string", UniversalSymbolNullable.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UniversalSymbolNullable.openapiRequiredFields) { + if (jsonObj.get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + } + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (!jsonObj.get("symbol").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `symbol` to be a primitive type in the JSON string but got `%s`", jsonObj.get("symbol").toString())); + } + if (!jsonObj.get("raw_symbol").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `raw_symbol` to be a primitive type in the JSON string but got `%s`", jsonObj.get("raw_symbol").toString())); + } + if (!jsonObj.get("description").isJsonNull() && (jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + // validate the required field `currency` + Currency.validateJsonObject(jsonObj.getAsJsonObject("currency")); + // validate the optional field `exchange` + if (jsonObj.get("exchange") != null && !jsonObj.get("exchange").isJsonNull()) { + Exchange.validateJsonObject(jsonObj.getAsJsonObject("exchange")); + } + // validate the required field `type` + SecurityType.validateJsonObject(jsonObj.getAsJsonObject("type")); + // ensure the json data is an array + if (!jsonObj.get("currencies").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `currencies` to be an array in the JSON string but got `%s`", jsonObj.get("currencies").toString())); + } + + JsonArray jsonArraycurrencies = jsonObj.getAsJsonArray("currencies"); + // validate the required field `currencies` (array) + for (int i = 0; i < jsonArraycurrencies.size(); i++) { + Currency.validateJsonObject(jsonArraycurrencies.get(i).getAsJsonObject()); + }; + if (!jsonObj.get("figi_code").isJsonNull() && (jsonObj.get("figi_code") != null && !jsonObj.get("figi_code").isJsonNull()) && !jsonObj.get("figi_code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `figi_code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("figi_code").toString())); + } + // validate the optional field `figi_instrument` + if (jsonObj.get("figi_instrument") != null && !jsonObj.get("figi_instrument").isJsonNull()) { + FigiInstrumentNullable.validateJsonObject(jsonObj.getAsJsonObject("figi_instrument")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UniversalSymbolNullable.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UniversalSymbolNullable' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UniversalSymbolNullable.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UniversalSymbolNullable value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public UniversalSymbolNullable read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + UniversalSymbolNullable instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UniversalSymbolNullable given an JSON string + * + * @param jsonString JSON string + * @return An instance of UniversalSymbolNullable + * @throws IOException if the JSON string is invalid with respect to UniversalSymbolNullable + */ + public static UniversalSymbolNullable fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UniversalSymbolNullable.class); + } + + /** + * Convert an instance of UniversalSymbolNullable to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/UserErrorLog.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/UserErrorLog.java new file mode 100644 index 0000000000..1f54a98387 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/UserErrorLog.java @@ -0,0 +1,492 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * An API error log for a specific SnapTrade user. + */ +@ApiModel(description = "An API error log for a specific SnapTrade user.")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class UserErrorLog { + public static final String SERIALIZED_NAME_REQUESTED_AT = "requestedAt"; + @SerializedName(SERIALIZED_NAME_REQUESTED_AT) + private String requestedAt; + + public static final String SERIALIZED_NAME_RESPONSE = "response"; + @SerializedName(SERIALIZED_NAME_RESPONSE) + private String response; + + public static final String SERIALIZED_NAME_STATUS_CODE = "statusCode"; + @SerializedName(SERIALIZED_NAME_STATUS_CODE) + private Double statusCode; + + public static final String SERIALIZED_NAME_QUERY_PARAMS = "queryParams"; + @SerializedName(SERIALIZED_NAME_QUERY_PARAMS) + private String queryParams; + + public static final String SERIALIZED_NAME_HTTP_METHOD = "httpMethod"; + @SerializedName(SERIALIZED_NAME_HTTP_METHOD) + private String httpMethod; + + public static final String SERIALIZED_NAME_ENDPOINT = "endpoint"; + @SerializedName(SERIALIZED_NAME_ENDPOINT) + private String endpoint; + + public UserErrorLog() { + } + + public UserErrorLog requestedAt(String requestedAt) { + + + + + this.requestedAt = requestedAt; + return this; + } + + /** + * Get requestedAt + * @return requestedAt + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2022-01-21T20:11:19.217Z", value = "") + + public String getRequestedAt() { + return requestedAt; + } + + + public void setRequestedAt(String requestedAt) { + + + + this.requestedAt = requestedAt; + } + + + public UserErrorLog response(String response) { + + + + + this.response = response; + return this; + } + + /** + * Get response + * @return response + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public String getResponse() { + return response; + } + + + public void setResponse(String response) { + + + + this.response = response; + } + + + public UserErrorLog statusCode(Double statusCode) { + + + + + this.statusCode = statusCode; + return this; + } + + public UserErrorLog statusCode(Integer statusCode) { + + + + + this.statusCode = statusCode.doubleValue(); + return this; + } + + /** + * Get statusCode + * @return statusCode + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "200", value = "") + + public Double getStatusCode() { + return statusCode; + } + + + public void setStatusCode(Double statusCode) { + + + + this.statusCode = statusCode; + } + + + public UserErrorLog queryParams(String queryParams) { + + + + + this.queryParams = queryParams; + return this; + } + + /** + * Get queryParams + * @return queryParams + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public String getQueryParams() { + return queryParams; + } + + + public void setQueryParams(String queryParams) { + + + + this.queryParams = queryParams; + } + + + public UserErrorLog httpMethod(String httpMethod) { + + + + + this.httpMethod = httpMethod; + return this; + } + + /** + * Get httpMethod + * @return httpMethod + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "POST", value = "") + + public String getHttpMethod() { + return httpMethod; + } + + + public void setHttpMethod(String httpMethod) { + + + + this.httpMethod = httpMethod; + } + + + public UserErrorLog endpoint(String endpoint) { + + + + + this.endpoint = endpoint; + return this; + } + + /** + * Get endpoint + * @return endpoint + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "api/v1/snapTrade", value = "") + + public String getEndpoint() { + return endpoint; + } + + + public void setEndpoint(String endpoint) { + + + + this.endpoint = endpoint; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UserErrorLog instance itself + */ + public UserErrorLog putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserErrorLog userErrorLog = (UserErrorLog) o; + return Objects.equals(this.requestedAt, userErrorLog.requestedAt) && + Objects.equals(this.response, userErrorLog.response) && + Objects.equals(this.statusCode, userErrorLog.statusCode) && + Objects.equals(this.queryParams, userErrorLog.queryParams) && + Objects.equals(this.httpMethod, userErrorLog.httpMethod) && + Objects.equals(this.endpoint, userErrorLog.endpoint)&& + Objects.equals(this.additionalProperties, userErrorLog.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(requestedAt, response, statusCode, queryParams, httpMethod, endpoint, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UserErrorLog {\n"); + sb.append(" requestedAt: ").append(toIndentedString(requestedAt)).append("\n"); + sb.append(" response: ").append(toIndentedString(response)).append("\n"); + sb.append(" statusCode: ").append(toIndentedString(statusCode)).append("\n"); + sb.append(" queryParams: ").append(toIndentedString(queryParams)).append("\n"); + sb.append(" httpMethod: ").append(toIndentedString(httpMethod)).append("\n"); + sb.append(" endpoint: ").append(toIndentedString(endpoint)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("requestedAt"); + openapiFields.add("response"); + openapiFields.add("statusCode"); + openapiFields.add("queryParams"); + openapiFields.add("httpMethod"); + openapiFields.add("endpoint"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to UserErrorLog + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!UserErrorLog.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UserErrorLog is not found in the empty JSON string", UserErrorLog.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("requestedAt") != null && !jsonObj.get("requestedAt").isJsonNull()) && !jsonObj.get("requestedAt").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `requestedAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("requestedAt").toString())); + } + if ((jsonObj.get("response") != null && !jsonObj.get("response").isJsonNull()) && !jsonObj.get("response").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `response` to be a primitive type in the JSON string but got `%s`", jsonObj.get("response").toString())); + } + if ((jsonObj.get("queryParams") != null && !jsonObj.get("queryParams").isJsonNull()) && !jsonObj.get("queryParams").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `queryParams` to be a primitive type in the JSON string but got `%s`", jsonObj.get("queryParams").toString())); + } + if ((jsonObj.get("httpMethod") != null && !jsonObj.get("httpMethod").isJsonNull()) && !jsonObj.get("httpMethod").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `httpMethod` to be a primitive type in the JSON string but got `%s`", jsonObj.get("httpMethod").toString())); + } + if ((jsonObj.get("endpoint") != null && !jsonObj.get("endpoint").isJsonNull()) && !jsonObj.get("endpoint").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `endpoint` to be a primitive type in the JSON string but got `%s`", jsonObj.get("endpoint").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UserErrorLog.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UserErrorLog' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UserErrorLog.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UserErrorLog value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public UserErrorLog read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + UserErrorLog instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UserErrorLog given an JSON string + * + * @param jsonString JSON string + * @return An instance of UserErrorLog + * @throws IOException if the JSON string is invalid with respect to UserErrorLog + */ + public static UserErrorLog fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UserErrorLog.class); + } + + /** + * Convert an instance of UserErrorLog to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/UserIDandSecret.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/UserIDandSecret.java new file mode 100644 index 0000000000..11b581c4c5 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/UserIDandSecret.java @@ -0,0 +1,330 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Response when register user is successful + */ +@ApiModel(description = "Response when register user is successful")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class UserIDandSecret { + public static final String SERIALIZED_NAME_USER_ID = "userId"; + @SerializedName(SERIALIZED_NAME_USER_ID) + private String userId; + + public static final String SERIALIZED_NAME_USER_SECRET = "userSecret"; + @SerializedName(SERIALIZED_NAME_USER_SECRET) + private String userSecret; + + public UserIDandSecret() { + } + + public UserIDandSecret userId(String userId) { + + + + + this.userId = userId; + return this; + } + + /** + * SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable. + * @return userId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "snaptrade-user-123", value = "SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.") + + public String getUserId() { + return userId; + } + + + public void setUserId(String userId) { + + + + this.userId = userId; + } + + + public UserIDandSecret userSecret(String userSecret) { + + + + + this.userSecret = userSecret; + return this; + } + + /** + * SnapTrade User Secret randomly generated by SnapTrade. This is privileged information and if compromised, should be rotated via the SnapTrade API. + * @return userSecret + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "h81@cx1lkalablakwjaltkejraj11=", value = "SnapTrade User Secret randomly generated by SnapTrade. This is privileged information and if compromised, should be rotated via the SnapTrade API.") + + public String getUserSecret() { + return userSecret; + } + + + public void setUserSecret(String userSecret) { + + + + this.userSecret = userSecret; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UserIDandSecret instance itself + */ + public UserIDandSecret putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserIDandSecret userIDandSecret = (UserIDandSecret) o; + return Objects.equals(this.userId, userIDandSecret.userId) && + Objects.equals(this.userSecret, userIDandSecret.userSecret)&& + Objects.equals(this.additionalProperties, userIDandSecret.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(userId, userSecret, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UserIDandSecret {\n"); + sb.append(" userId: ").append(toIndentedString(userId)).append("\n"); + sb.append(" userSecret: ").append(toIndentedString(userSecret)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("userId"); + openapiFields.add("userSecret"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to UserIDandSecret + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!UserIDandSecret.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UserIDandSecret is not found in the empty JSON string", UserIDandSecret.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("userId") != null && !jsonObj.get("userId").isJsonNull()) && !jsonObj.get("userId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `userId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("userId").toString())); + } + if ((jsonObj.get("userSecret") != null && !jsonObj.get("userSecret").isJsonNull()) && !jsonObj.get("userSecret").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `userSecret` to be a primitive type in the JSON string but got `%s`", jsonObj.get("userSecret").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UserIDandSecret.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UserIDandSecret' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UserIDandSecret.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UserIDandSecret value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public UserIDandSecret read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + UserIDandSecret instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UserIDandSecret given an JSON string + * + * @param jsonString JSON string + * @return An instance of UserIDandSecret + * @throws IOException if the JSON string is invalid with respect to UserIDandSecret + */ + public static UserIDandSecret fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UserIDandSecret.class); + } + + /** + * Convert an instance of UserIDandSecret to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/UserSettings.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/UserSettings.java new file mode 100644 index 0000000000..ce28afab92 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/UserSettings.java @@ -0,0 +1,635 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.Currency; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * User account settings + */ +@ApiModel(description = "User account settings")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class UserSettings { + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_RECEIVE_CASH_NOTIFICATION = "receive_cash_notification"; + @SerializedName(SERIALIZED_NAME_RECEIVE_CASH_NOTIFICATION) + private Boolean receiveCashNotification; + + public static final String SERIALIZED_NAME_RECEIVE_DRIFT_NOTIFICATION = "receive_drift_notification"; + @SerializedName(SERIALIZED_NAME_RECEIVE_DRIFT_NOTIFICATION) + private Boolean receiveDriftNotification; + + public static final String SERIALIZED_NAME_USER_TRIAL_ACTIVATED = "user_trial_activated"; + @SerializedName(SERIALIZED_NAME_USER_TRIAL_ACTIVATED) + private Boolean userTrialActivated; + + public static final String SERIALIZED_NAME_ACTIVATED_TRIAL_DATE = "activated_trial_date"; + @SerializedName(SERIALIZED_NAME_ACTIVATED_TRIAL_DATE) + private String activatedTrialDate; + + public static final String SERIALIZED_NAME_DEMO = "demo"; + @SerializedName(SERIALIZED_NAME_DEMO) + private Boolean demo; + + public static final String SERIALIZED_NAME_API_ENABLED = "api_enabled"; + @SerializedName(SERIALIZED_NAME_API_ENABLED) + private Boolean apiEnabled; + + public static final String SERIALIZED_NAME_DRIFT_THRESHOLD = "drift_threshold"; + @SerializedName(SERIALIZED_NAME_DRIFT_THRESHOLD) + private Double driftThreshold; + + public static final String SERIALIZED_NAME_PREFERRED_CURRENCY = "preferred_currency"; + @SerializedName(SERIALIZED_NAME_PREFERRED_CURRENCY) + private Currency preferredCurrency; + + public UserSettings() { + } + + public UserSettings email(String email) { + + + + + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "ops@snaptrade.com", value = "") + + public String getEmail() { + return email; + } + + + public void setEmail(String email) { + + + + this.email = email; + } + + + public UserSettings name(String name) { + + + + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "James Bond", value = "") + + public String getName() { + return name; + } + + + public void setName(String name) { + + + + this.name = name; + } + + + public UserSettings receiveCashNotification(Boolean receiveCashNotification) { + + + + + this.receiveCashNotification = receiveCashNotification; + return this; + } + + /** + * Get receiveCashNotification + * @return receiveCashNotification + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "true", value = "") + + public Boolean getReceiveCashNotification() { + return receiveCashNotification; + } + + + public void setReceiveCashNotification(Boolean receiveCashNotification) { + + + + this.receiveCashNotification = receiveCashNotification; + } + + + public UserSettings receiveDriftNotification(Boolean receiveDriftNotification) { + + + + + this.receiveDriftNotification = receiveDriftNotification; + return this; + } + + /** + * Get receiveDriftNotification + * @return receiveDriftNotification + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "true", value = "") + + public Boolean getReceiveDriftNotification() { + return receiveDriftNotification; + } + + + public void setReceiveDriftNotification(Boolean receiveDriftNotification) { + + + + this.receiveDriftNotification = receiveDriftNotification; + } + + + public UserSettings userTrialActivated(Boolean userTrialActivated) { + + + + + this.userTrialActivated = userTrialActivated; + return this; + } + + /** + * Get userTrialActivated + * @return userTrialActivated + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "true", value = "") + + public Boolean getUserTrialActivated() { + return userTrialActivated; + } + + + public void setUserTrialActivated(Boolean userTrialActivated) { + + + + this.userTrialActivated = userTrialActivated; + } + + + public UserSettings activatedTrialDate(String activatedTrialDate) { + + + + + this.activatedTrialDate = activatedTrialDate; + return this; + } + + /** + * Get activatedTrialDate + * @return activatedTrialDate + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2017-07-17T15:13:07.177712+00:00", value = "") + + public String getActivatedTrialDate() { + return activatedTrialDate; + } + + + public void setActivatedTrialDate(String activatedTrialDate) { + + + + this.activatedTrialDate = activatedTrialDate; + } + + + public UserSettings demo(Boolean demo) { + + + + + this.demo = demo; + return this; + } + + /** + * Get demo + * @return demo + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "false", value = "") + + public Boolean getDemo() { + return demo; + } + + + public void setDemo(Boolean demo) { + + + + this.demo = demo; + } + + + public UserSettings apiEnabled(Boolean apiEnabled) { + + + + + this.apiEnabled = apiEnabled; + return this; + } + + /** + * Get apiEnabled + * @return apiEnabled + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "false", value = "") + + public Boolean getApiEnabled() { + return apiEnabled; + } + + + public void setApiEnabled(Boolean apiEnabled) { + + + + this.apiEnabled = apiEnabled; + } + + + public UserSettings driftThreshold(Double driftThreshold) { + + + + + this.driftThreshold = driftThreshold; + return this; + } + + public UserSettings driftThreshold(Integer driftThreshold) { + + + + + this.driftThreshold = driftThreshold.doubleValue(); + return this; + } + + /** + * Get driftThreshold + * @return driftThreshold + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "95", value = "") + + public Double getDriftThreshold() { + return driftThreshold; + } + + + public void setDriftThreshold(Double driftThreshold) { + + + + this.driftThreshold = driftThreshold; + } + + + public UserSettings preferredCurrency(Currency preferredCurrency) { + + + + + this.preferredCurrency = preferredCurrency; + return this; + } + + /** + * Get preferredCurrency + * @return preferredCurrency + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Currency getPreferredCurrency() { + return preferredCurrency; + } + + + public void setPreferredCurrency(Currency preferredCurrency) { + + + + this.preferredCurrency = preferredCurrency; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UserSettings instance itself + */ + public UserSettings putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserSettings userSettings = (UserSettings) o; + return Objects.equals(this.email, userSettings.email) && + Objects.equals(this.name, userSettings.name) && + Objects.equals(this.receiveCashNotification, userSettings.receiveCashNotification) && + Objects.equals(this.receiveDriftNotification, userSettings.receiveDriftNotification) && + Objects.equals(this.userTrialActivated, userSettings.userTrialActivated) && + Objects.equals(this.activatedTrialDate, userSettings.activatedTrialDate) && + Objects.equals(this.demo, userSettings.demo) && + Objects.equals(this.apiEnabled, userSettings.apiEnabled) && + Objects.equals(this.driftThreshold, userSettings.driftThreshold) && + Objects.equals(this.preferredCurrency, userSettings.preferredCurrency)&& + Objects.equals(this.additionalProperties, userSettings.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(email, name, receiveCashNotification, receiveDriftNotification, userTrialActivated, activatedTrialDate, demo, apiEnabled, driftThreshold, preferredCurrency, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UserSettings {\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" receiveCashNotification: ").append(toIndentedString(receiveCashNotification)).append("\n"); + sb.append(" receiveDriftNotification: ").append(toIndentedString(receiveDriftNotification)).append("\n"); + sb.append(" userTrialActivated: ").append(toIndentedString(userTrialActivated)).append("\n"); + sb.append(" activatedTrialDate: ").append(toIndentedString(activatedTrialDate)).append("\n"); + sb.append(" demo: ").append(toIndentedString(demo)).append("\n"); + sb.append(" apiEnabled: ").append(toIndentedString(apiEnabled)).append("\n"); + sb.append(" driftThreshold: ").append(toIndentedString(driftThreshold)).append("\n"); + sb.append(" preferredCurrency: ").append(toIndentedString(preferredCurrency)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("email"); + openapiFields.add("name"); + openapiFields.add("receive_cash_notification"); + openapiFields.add("receive_drift_notification"); + openapiFields.add("user_trial_activated"); + openapiFields.add("activated_trial_date"); + openapiFields.add("demo"); + openapiFields.add("api_enabled"); + openapiFields.add("drift_threshold"); + openapiFields.add("preferred_currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to UserSettings + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!UserSettings.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UserSettings is not found in the empty JSON string", UserSettings.openapiRequiredFields.toString())); + } + } + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("activated_trial_date") != null && !jsonObj.get("activated_trial_date").isJsonNull()) && !jsonObj.get("activated_trial_date").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `activated_trial_date` to be a primitive type in the JSON string but got `%s`", jsonObj.get("activated_trial_date").toString())); + } + // validate the optional field `preferred_currency` + if (jsonObj.get("preferred_currency") != null && !jsonObj.get("preferred_currency").isJsonNull()) { + Currency.validateJsonObject(jsonObj.getAsJsonObject("preferred_currency")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UserSettings.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UserSettings' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UserSettings.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UserSettings value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public UserSettings read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + UserSettings instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UserSettings given an JSON string + * + * @param jsonString JSON string + * @return An instance of UserSettings + * @throws IOException if the JSON string is invalid with respect to UserSettings + */ + public static UserSettings fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UserSettings.class); + } + + /** + * Convert an instance of UserSettings to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ValidatedTradeBody.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ValidatedTradeBody.java new file mode 100644 index 0000000000..aa3b6a0818 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/main/java/com/konfigthis/client/model/ValidatedTradeBody.java @@ -0,0 +1,300 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import org.apache.commons.lang3.StringUtils; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.konfigthis.client.JSON; + +/** + * Validated Trade Form + */ +@ApiModel(description = "Validated Trade Form")@javax.annotation.Generated(value = "Generated by https://konfigthis.com") +public class ValidatedTradeBody { + public static final String SERIALIZED_NAME_WAIT_TO_CONFIRM = "wait_to_confirm"; + @SerializedName(SERIALIZED_NAME_WAIT_TO_CONFIRM) + private Boolean waitToConfirm; + + public ValidatedTradeBody() { + } + + public ValidatedTradeBody waitToConfirm(Boolean waitToConfirm) { + + + + + this.waitToConfirm = waitToConfirm; + return this; + } + + /** + * Optional, defaults to true. Determines if a wait is performed to check on order status. If false, latency will be reduced but orders returned will be more likely to be of status PENDING as we will not wait to check on the status before responding to the request + * @return waitToConfirm + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "true", value = "Optional, defaults to true. Determines if a wait is performed to check on order status. If false, latency will be reduced but orders returned will be more likely to be of status PENDING as we will not wait to check on the status before responding to the request") + + public Boolean getWaitToConfirm() { + return waitToConfirm; + } + + + public void setWaitToConfirm(Boolean waitToConfirm) { + + + + this.waitToConfirm = waitToConfirm; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ValidatedTradeBody instance itself + */ + public ValidatedTradeBody putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ValidatedTradeBody validatedTradeBody = (ValidatedTradeBody) o; + return Objects.equals(this.waitToConfirm, validatedTradeBody.waitToConfirm)&& + Objects.equals(this.additionalProperties, validatedTradeBody.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(waitToConfirm, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ValidatedTradeBody {\n"); + sb.append(" waitToConfirm: ").append(toIndentedString(waitToConfirm)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("wait_to_confirm"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to ValidatedTradeBody + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!ValidatedTradeBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ValidatedTradeBody is not found in the empty JSON string", ValidatedTradeBody.openapiRequiredFields.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ValidatedTradeBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ValidatedTradeBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ValidatedTradeBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ValidatedTradeBody value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additonal properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else if (entry.getValue() == null) { + obj.addProperty(entry.getKey(), (String) null); + } else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ValidatedTradeBody read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + ValidatedTradeBody instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ValidatedTradeBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of ValidatedTradeBody + * @throws IOException if the JSON string is invalid with respect to ValidatedTradeBody + */ + public static ValidatedTradeBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ValidatedTradeBody.class); + } + + /** + * Convert an instance of ValidatedTradeBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/GettingStartedTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/GettingStartedTest.java new file mode 100644 index 0000000000..311553f838 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/GettingStartedTest.java @@ -0,0 +1,30 @@ +package com.konfigthis.client; + +import com.konfigthis.client.model.ActionStrict; +import com.konfigthis.client.model.ManualTradeAndImpact; +import org.junit.jupiter.api.Test; + +import static org.junit.Assert.assertNotNull; + +import java.util.UUID; + +public class GettingStartedTest { + final String MOCK_SERVER_URL = "http://localhost:4107"; + + @Test + public void getOrderImpact() throws ApiException { + Configuration configuration = new Configuration(); + configuration.clientId = "SNAPTRADE_CLIENT_ID"; + configuration.consumerKey = "SNAPTRADE_CONSUMER_KEY"; + configuration.host = MOCK_SERVER_URL; + Snaptrade snaptrade = new Snaptrade(configuration); + String userId = UUID.randomUUID().toString(); + String userSecret = UUID.randomUUID().toString(); + ManualTradeAndImpact result = + snaptrade.trading.getOrderImpact(userId, userSecret).action(ActionStrict.BUY).price(10).units(1).execute(); + assertNotNull(result); + String serialized = result.toJson(); + assertNotNull(serialized); + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/SimpleTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/SimpleTest.java new file mode 100644 index 0000000000..c0fd4656bf --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/SimpleTest.java @@ -0,0 +1,20 @@ +package com.konfigthis.client; + +import static org.junit.Assert.assertNotNull; + +import org.junit.jupiter.api.Test; + +public class SimpleTest { + final String MOCK_SERVER_URL = "http://localhost:4010"; + + @Test + public void initClientTest() { + Configuration configuration = new Configuration(); + configuration.host = "https://api.snaptrade.com/api/v1"; + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + + Snaptrade client = new Snaptrade(configuration); + assertNotNull(client); + } +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/api/AccountInformationApiTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/api/AccountInformationApiTest.java new file mode 100644 index 0000000000..e2eaea6a7c --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/api/AccountInformationApiTest.java @@ -0,0 +1,190 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.api; + +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.model.Account; +import com.konfigthis.client.model.AccountHoldings; +import com.konfigthis.client.model.AccountHoldingsAccount; +import com.konfigthis.client.model.AccountOrderRecord; +import com.konfigthis.client.model.Balance; +import com.konfigthis.client.model.Position; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.BeforeAll; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for AccountInformationApi + */ +@Disabled +public class AccountInformationApiTest { + + private static AccountInformationApi api; + + + @BeforeAll + public static void beforeClass() { + ApiClient apiClient = Configuration.getDefaultApiClient(); + api = new AccountInformationApi(apiClient); + } + + /** + * List all accounts for the user, plus balances, positions, and orders for each account. + * + * **Deprecated, please use the account-specific holdings endpoint instead.** List all accounts for the user, plus balances, positions, and orders for each account. + * + * @throws ApiException if the Api call fails + */ + @Test + public void getAllUserHoldingsTest() throws ApiException { + String userId = null; + String userSecret = null; + UUID brokerageAuthorizations = null; + List response = api.getAllUserHoldings(userId, userSecret) + .brokerageAuthorizations(brokerageAuthorizations) + .execute(); + // TODO: test validations + } + + /** + * List account balances + * + * A list of account balances for the specified account (one per currency that the account holds). + * + * @throws ApiException if the Api call fails + */ + @Test + public void getUserAccountBalanceTest() throws ApiException { + String userId = null; + String userSecret = null; + UUID accountId = null; + List response = api.getUserAccountBalance(userId, userSecret, accountId) + .execute(); + // TODO: test validations + } + + /** + * Return details of a specific investment account + * + * Returns an account object with details for the specified account, including the total account market value. + * + * @throws ApiException if the Api call fails + */ + @Test + public void getUserAccountDetailsTest() throws ApiException { + String userId = null; + String userSecret = null; + UUID accountId = null; + Account response = api.getUserAccountDetails(userId, userSecret, accountId) + .execute(); + // TODO: test validations + } + + /** + * List account orders + * + * Fetch all recent orders from a user's account. + * + * @throws ApiException if the Api call fails + */ + @Test + public void getUserAccountOrdersTest() throws ApiException { + String userId = null; + String userSecret = null; + UUID accountId = null; + String state = null; + Integer days = null; + List response = api.getUserAccountOrders(userId, userSecret, accountId) + .state(state) + .days(days) + .execute(); + // TODO: test validations + } + + /** + * List account positions + * + * Returns a list of positions in the specified account. + * + * @throws ApiException if the Api call fails + */ + @Test + public void getUserAccountPositionsTest() throws ApiException { + String userId = null; + String userSecret = null; + UUID accountId = null; + List response = api.getUserAccountPositions(userId, userSecret, accountId) + .execute(); + // TODO: test validations + } + + /** + * List account holdings + * + * Lists balances, positions, option positions, and recent orders for the specified account. The data returned is similar to the data returned over the more fine-grained [balances](/reference/Account%20Information/AccountInformation_getUserAccountBalance), [positions](/reference/Account%20Information/AccountInformation_getUserAccountPositions) and [orders](/reference/Account%20Information/AccountInformation_getUserAccountOrders) endpoints. __The finer-grained APIs are preferred. They are easier to work with, faster, and have better error handling than this coarse-grained API.__ + * + * @throws ApiException if the Api call fails + */ + @Test + public void getUserHoldingsTest() throws ApiException { + UUID accountId = null; + String userId = null; + String userSecret = null; + AccountHoldingsAccount response = api.getUserHoldings(accountId, userId, userSecret) + .execute(); + // TODO: test validations + } + + /** + * List accounts + * + * Get a list of all Account objects for the authenticated SnapTrade user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void listUserAccountsTest() throws ApiException { + String userId = null; + String userSecret = null; + List response = api.listUserAccounts(userId, userSecret) + .execute(); + // TODO: test validations + } + + /** + * Update details of an investment account + * + * Updates various properties of a specified account. + * + * @throws ApiException if the Api call fails + */ + @Test + public void updateUserAccountTest() throws ApiException { + String userId = null; + String userSecret = null; + UUID accountId = null; + List response = api.updateUserAccount(userId, userSecret, accountId) + .execute(); + // TODO: test validations + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/api/ApiStatusApiTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/api/ApiStatusApiTest.java new file mode 100644 index 0000000000..c60a877557 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/api/ApiStatusApiTest.java @@ -0,0 +1,58 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.api; + +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.model.Status; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.BeforeAll; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for ApiStatusApi + */ +@Disabled +public class ApiStatusApiTest { + + private static ApiStatusApi api; + + + @BeforeAll + public static void beforeClass() { + ApiClient apiClient = Configuration.getDefaultApiClient(); + api = new ApiStatusApi(apiClient); + } + + /** + * Get API Status + * + * Check whether the API is operational and verify timestamps. + * + * @throws ApiException if the Api call fails + */ + @Test + public void checkTest() throws ApiException { + Status response = api.check() + .execute(); + // TODO: test validations + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/api/AuthenticationApiTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/api/AuthenticationApiTest.java new file mode 100644 index 0000000000..b8dc528ae2 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/api/AuthenticationApiTest.java @@ -0,0 +1,138 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.api; + +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.model.DeleteUserResponse; +import com.konfigthis.client.model.SnapTradeLoginUserRequestBody; +import com.konfigthis.client.model.SnapTradeRegisterUserRequestBody; +import com.konfigthis.client.model.UserIDandSecret; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.BeforeAll; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for AuthenticationApi + */ +@Disabled +public class AuthenticationApiTest { + + private static AuthenticationApi api; + + + @BeforeAll + public static void beforeClass() { + ApiClient apiClient = Configuration.getDefaultApiClient(); + api = new AuthenticationApi(apiClient); + } + + /** + * Delete SnapTrade user + * + * Deletes a user you've registered over the SnapTrade API, and any data associated with them or their investment accounts. + * + * @throws ApiException if the Api call fails + */ + @Test + public void deleteSnapTradeUserTest() throws ApiException { + String userId = null; + DeleteUserResponse response = api.deleteSnapTradeUser(userId) + .execute(); + // TODO: test validations + } + + /** + * List SnapTrade users + * + * Returns a list of users you've registered over the SnapTrade API. + * + * @throws ApiException if the Api call fails + */ + @Test + public void listSnapTradeUsersTest() throws ApiException { + List response = api.listSnapTradeUsers() + .execute(); + // TODO: test validations + } + + /** + * Login user & generate connection link + * + * Logs in a SnapTrade user and returns an authenticated connection portal URL for them to use to connect a brokerage account. + * + * @throws ApiException if the Api call fails + */ + @Test + public void loginSnapTradeUserTest() throws ApiException { + String userId = null; + String userSecret = null; + String broker = null; + Boolean immediateRedirect = null; + String customRedirect = null; + String reconnect = null; + String connectionType = null; + String connectionPortalVersion = null; + Object response = api.loginSnapTradeUser(userId, userSecret) + .broker(broker) + .immediateRedirect(immediateRedirect) + .customRedirect(customRedirect) + .reconnect(reconnect) + .connectionType(connectionType) + .connectionPortalVersion(connectionPortalVersion) + .execute(); + // TODO: test validations + } + + /** + * Create SnapTrade user + * + * Registers a new SnapTrade user under your ClientID. A user secret will be automatically generated for you and must be properly stored in your database. Most SnapTrade operations require a user ID and user secret to be passed as a parameter. + * + * @throws ApiException if the Api call fails + */ + @Test + public void registerSnapTradeUserTest() throws ApiException { + String userId = null; + UserIDandSecret response = api.registerSnapTradeUser() + .userId(userId) + .execute(); + // TODO: test validations + } + + /** + * Obtain a new user secret for a user + * + * This API is used to rotate the secret for a SnapTrade user. You might use this if a userSecret is compromised. Please note that if you call this endpoint and fail to save the new secret, you'll no longer be able to access any data for this user, and your only option will be to delete and recreate the user, then ask them to reconnect. + * + * @throws ApiException if the Api call fails + */ + @Test + public void resetSnapTradeUserSecretTest() throws ApiException { + String userId = null; + String userSecret = null; + UserIDandSecret response = api.resetSnapTradeUserSecret() + .userId(userId) + .userSecret(userSecret) + .execute(); + // TODO: test validations + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/api/ConnectionsApiTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/api/ConnectionsApiTest.java new file mode 100644 index 0000000000..76ce32c41a --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/api/ConnectionsApiTest.java @@ -0,0 +1,151 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.api; + +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.model.BrokerageAuthorization; +import com.konfigthis.client.model.BrokerageAuthorizationDisabledConfirmation; +import com.konfigthis.client.model.BrokerageAuthorizationRefreshConfirmation; +import com.konfigthis.client.model.SessionEvent; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.BeforeAll; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for ConnectionsApi + */ +@Disabled +public class ConnectionsApiTest { + + private static ConnectionsApi api; + + + @BeforeAll + public static void beforeClass() { + ApiClient apiClient = Configuration.getDefaultApiClient(); + api = new ConnectionsApi(apiClient); + } + + /** + * Get brokerage authorization details + * + * Returns a single brokerage authorization object for the specified ID. + * + * @throws ApiException if the Api call fails + */ + @Test + public void detailBrokerageAuthorizationTest() throws ApiException { + UUID authorizationId = null; + String userId = null; + String userSecret = null; + BrokerageAuthorization response = api.detailBrokerageAuthorization(authorizationId, userId, userSecret) + .execute(); + // TODO: test validations + } + + /** + * Manually disable a connection for testing + * + * Manually disable a connection. This should only be used for testing a reconnect flow, and never used on production connections. Will trigger a disconnect as if it happened naturally, and send a CONNECTION_BROKEN webhook for the connection. Please contact us in order to use this endpoint as it is disabled by default. + * + * @throws ApiException if the Api call fails + */ + @Test + public void disableBrokerageAuthorizationTest() throws ApiException { + UUID authorizationId = null; + String userId = null; + String userSecret = null; + BrokerageAuthorizationDisabledConfirmation response = api.disableBrokerageAuthorization(authorizationId, userId, userSecret) + .execute(); + // TODO: test validations + } + + /** + * List all brokerage authorizations for the User + * + * Returns a list of Brokerage Authorization objects for the user + * + * @throws ApiException if the Api call fails + */ + @Test + public void listBrokerageAuthorizationsTest() throws ApiException { + String userId = null; + String userSecret = null; + List response = api.listBrokerageAuthorizations(userId, userSecret) + .execute(); + // TODO: test validations + } + + /** + * Refresh holdings for a connection + * + * Trigger a holdings update for all accounts under this authorization. Updates will be queued asynchronously. ACCOUNT_HOLDINGS_UPDATED webhook will be sent once the sync completes. Please contact support for access as this endpoint is not enabled by default + * + * @throws ApiException if the Api call fails + */ + @Test + public void refreshBrokerageAuthorizationTest() throws ApiException { + UUID authorizationId = null; + String userId = null; + String userSecret = null; + BrokerageAuthorizationRefreshConfirmation response = api.refreshBrokerageAuthorization(authorizationId, userId, userSecret) + .execute(); + // TODO: test validations + } + + /** + * Delete brokerage authorization + * + * Deletes a specified brokerage authorization given by the ID. + * + * @throws ApiException if the Api call fails + */ + @Test + public void removeBrokerageAuthorizationTest() throws ApiException { + UUID authorizationId = null; + String userId = null; + String userSecret = null; + api.removeBrokerageAuthorization(authorizationId, userId, userSecret) + .execute(); + // TODO: test validations + } + + /** + * Get all session events for a user + * + * Returns a list of session events associated with a user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void sessionEventsTest() throws ApiException { + String partnerClientId = null; + String userId = null; + String sessionId = null; + List response = api.sessionEvents(partnerClientId) + .userId(userId) + .sessionId(sessionId) + .execute(); + // TODO: test validations + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/api/OptionsApiTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/api/OptionsApiTest.java new file mode 100644 index 0000000000..85d0fdec8b --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/api/OptionsApiTest.java @@ -0,0 +1,148 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.api; + +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.model.OptionChainInner; +import com.konfigthis.client.model.OptionLeg; +import com.konfigthis.client.model.OptionsGetOptionStrategyRequest; +import com.konfigthis.client.model.OptionsPlaceOptionStrategyRequest; +import com.konfigthis.client.model.OptionsPosition; +import com.konfigthis.client.model.OrderTypeStrict; +import com.konfigthis.client.model.StrategyOrderRecord; +import com.konfigthis.client.model.StrategyQuotes; +import com.konfigthis.client.model.TimeInForceStrict; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.BeforeAll; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for OptionsApi + */ +@Disabled +public class OptionsApiTest { + + private static OptionsApi api; + + + @BeforeAll + public static void beforeClass() { + ApiClient apiClient = Configuration.getDefaultApiClient(); + api = new OptionsApi(apiClient); + } + + /** + * Create options strategy + * + * Creates an option strategy object that will be used to place an option strategy order. + * + * @throws ApiException if the Api call fails + */ + @Test + public void getOptionStrategyTest() throws ApiException { + UUID underlyingSymbolId = null; + List legs = null; + String strategyType = null; + String userId = null; + String userSecret = null; + UUID accountId = null; + StrategyQuotes response = api.getOptionStrategy(underlyingSymbolId, legs, strategyType, userId, userSecret, accountId) + .execute(); + // TODO: test validations + } + + /** + * Get the options chain for a symbol + * + * Returns the option chain for the specified symbol in the specified account. + * + * @throws ApiException if the Api call fails + */ + @Test + public void getOptionsChainTest() throws ApiException { + String userId = null; + String userSecret = null; + UUID accountId = null; + UUID symbol = null; + List response = api.getOptionsChain(userId, userSecret, accountId, symbol) + .execute(); + // TODO: test validations + } + + /** + * Get options strategy quotes + * + * Returns a Strategy Quotes object which has latest market data of the specified option strategy. + * + * @throws ApiException if the Api call fails + */ + @Test + public void getOptionsStrategyQuoteTest() throws ApiException { + String userId = null; + String userSecret = null; + UUID accountId = null; + UUID optionStrategyId = null; + StrategyQuotes response = api.getOptionsStrategyQuote(userId, userSecret, accountId, optionStrategyId) + .execute(); + // TODO: test validations + } + + /** + * Get account option holdings + * + * Returns a list of Options Positions. + * + * @throws ApiException if the Api call fails + */ + @Test + public void listOptionHoldingsTest() throws ApiException { + String userId = null; + String userSecret = null; + UUID accountId = null; + List response = api.listOptionHoldings(userId, userSecret, accountId) + .execute(); + // TODO: test validations + } + + /** + * Place an option strategy order + * + * Places the option strategy order and returns the order record received from the brokerage. + * + * @throws ApiException if the Api call fails + */ + @Test + public void placeOptionStrategyTest() throws ApiException { + OrderTypeStrict orderType = null; + TimeInForceStrict timeInForce = null; + String userId = null; + String userSecret = null; + UUID accountId = null; + UUID optionStrategyId = null; + Double price = null; + StrategyOrderRecord response = api.placeOptionStrategy(orderType, timeInForce, userId, userSecret, accountId, optionStrategyId) + .price(price) + .execute(); + // TODO: test validations + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/api/ReferenceDataApiTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/api/ReferenceDataApiTest.java new file mode 100644 index 0000000000..2dd2ac1efc --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/api/ReferenceDataApiTest.java @@ -0,0 +1,218 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.api; + +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.model.Brokerage; +import com.konfigthis.client.model.BrokerageAuthorizationTypeReadOnly; +import com.konfigthis.client.model.Currency; +import com.konfigthis.client.model.Exchange; +import com.konfigthis.client.model.ExchangeRatePairs; +import com.konfigthis.client.model.PartnerData; +import com.konfigthis.client.model.SecurityType; +import com.konfigthis.client.model.SymbolQuery; +import java.util.UUID; +import com.konfigthis.client.model.UniversalSymbol; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.BeforeAll; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for ReferenceDataApi + */ +@Disabled +public class ReferenceDataApiTest { + + private static ReferenceDataApi api; + + + @BeforeAll + public static void beforeClass() { + ApiClient apiClient = Configuration.getDefaultApiClient(); + api = new ReferenceDataApi(apiClient); + } + + /** + * Get exchange rate of a currency pair + * + * Returns an Exchange Rate Pair object for the specified Currency Pair. + * + * @throws ApiException if the Api call fails + */ + @Test + public void getCurrencyExchangeRatePairTest() throws ApiException { + String currencyPair = null; + ExchangeRatePairs response = api.getCurrencyExchangeRatePair(currencyPair) + .execute(); + // TODO: test validations + } + + /** + * Get metadata related to Snaptrade partner + * + * Returns useful data related to the specified ClientID, including allowed brokerages and data access. + * + * @throws ApiException if the Api call fails + */ + @Test + public void getPartnerInfoTest() throws ApiException { + PartnerData response = api.getPartnerInfo() + .execute(); + // TODO: test validations + } + + /** + * List of all security types + * + * List security types available on SnapTrade. + * + * @throws ApiException if the Api call fails + */ + @Test + public void getSecurityTypesTest() throws ApiException { + List response = api.getSecurityTypes() + .execute(); + // TODO: test validations + } + + /** + * Get exchanges + * + * Returns a list of all supported Exchanges. + * + * @throws ApiException if the Api call fails + */ + @Test + public void getStockExchangesTest() throws ApiException { + List response = api.getStockExchanges() + .execute(); + // TODO: test validations + } + + /** + * Search for symbols + * + * Returns a list of Universal Symbol objects that match a defined string. Matches on ticker or name. + * + * @throws ApiException if the Api call fails + */ + @Test + public void getSymbolsTest() throws ApiException { + String substring = null; + List response = api.getSymbols() + .substring(substring) + .execute(); + // TODO: test validations + } + + /** + * Get details of a symbol + * + * Returns the Universal Symbol object specified by the ticker or the universal_symbol_id. + * + * @throws ApiException if the Api call fails + */ + @Test + public void getSymbolsByTickerTest() throws ApiException { + String query = null; + UniversalSymbol response = api.getSymbolsByTicker(query) + .execute(); + // TODO: test validations + } + + /** + * Get all brokerage authorization types + * + * Returns a list of all defined Brokerage authorization Type objects. + * + * @throws ApiException if the Api call fails + */ + @Test + public void listAllBrokerageAuthorizationTypeTest() throws ApiException { + String brokerage = null; + List response = api.listAllBrokerageAuthorizationType() + .brokerage(brokerage) + .execute(); + // TODO: test validations + } + + /** + * Get brokerages + * + * Returns a list of all defined Brokerage objects. + * + * @throws ApiException if the Api call fails + */ + @Test + public void listAllBrokeragesTest() throws ApiException { + List response = api.listAllBrokerages() + .execute(); + // TODO: test validations + } + + /** + * Get currencies + * + * Returns a list of all defined Currency objects. + * + * @throws ApiException if the Api call fails + */ + @Test + public void listAllCurrenciesTest() throws ApiException { + List response = api.listAllCurrencies() + .execute(); + // TODO: test validations + } + + /** + * Get currency exchange rates + * + * Returns a list of all Exchange Rate Pairs for all supported Currencies. + * + * @throws ApiException if the Api call fails + */ + @Test + public void listAllCurrenciesRatesTest() throws ApiException { + List response = api.listAllCurrenciesRates() + .execute(); + // TODO: test validations + } + + /** + * Search for symbols available in an account + * + * Returns a list of universal symbols that are supported by the specificied account. Returned symbols are based on the provided search string, matching on ticker and name. + * + * @throws ApiException if the Api call fails + */ + @Test + public void symbolSearchUserAccountTest() throws ApiException { + String userId = null; + String userSecret = null; + UUID accountId = null; + String substring = null; + List response = api.symbolSearchUserAccount(userId, userSecret, accountId) + .substring(substring) + .execute(); + // TODO: test validations + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/api/TradingApiTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/api/TradingApiTest.java new file mode 100644 index 0000000000..a10ca2939a --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/api/TradingApiTest.java @@ -0,0 +1,179 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.api; + +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.model.AccountOrderRecord; +import com.konfigthis.client.model.ActionStrict; +import com.konfigthis.client.model.ManualTradeAndImpact; +import com.konfigthis.client.model.ManualTradeForm; +import com.konfigthis.client.model.OrderTypeStrict; +import com.konfigthis.client.model.SymbolsQuotesInner; +import com.konfigthis.client.model.TimeInForceStrict; +import com.konfigthis.client.model.TradingCancelUserAccountOrderRequest; +import java.util.UUID; +import com.konfigthis.client.model.ValidatedTradeBody; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.BeforeAll; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for TradingApi + */ +@Disabled +public class TradingApiTest { + + private static TradingApi api; + + + @BeforeAll + public static void beforeClass() { + ApiClient apiClient = Configuration.getDefaultApiClient(); + api = new TradingApi(apiClient); + } + + /** + * Cancel open order in account + * + * Sends a signal to the brokerage to cancel the specified order. This will only work if the order has not yet been executed. + * + * @throws ApiException if the Api call fails + */ + @Test + public void cancelUserAccountOrderTest() throws ApiException { + String userId = null; + String userSecret = null; + UUID accountId = null; + UUID brokerageOrderId = null; + AccountOrderRecord response = api.cancelUserAccountOrder(userId, userSecret, accountId) + .brokerageOrderId(brokerageOrderId) + .execute(); + // TODO: test validations + } + + /** + * Check the impact of a trade on an account + * + * Return the trade object and it's impact on the account for the specified order. + * + * @throws ApiException if the Api call fails + */ + @Test + public void getOrderImpactTest() throws ApiException { + String userId = null; + String userSecret = null; + UUID accountId = null; + ActionStrict action = null; + OrderTypeStrict orderType = null; + Double price = null; + Double stop = null; + TimeInForceStrict timeInForce = null; + Double units = null; + UUID universalSymbolId = null; + Object notionalValue = null; + ManualTradeAndImpact response = api.getOrderImpact(userId, userSecret) + .accountId(accountId) + .action(action) + .orderType(orderType) + .price(price) + .stop(stop) + .timeInForce(timeInForce) + .units(units) + .universalSymbolId(universalSymbolId) + .notionalValue(notionalValue) + .execute(); + // TODO: test validations + } + + /** + * Get symbol quotes + * + * Returns quote(s) from the brokerage for the specified symbol(s). + * + * @throws ApiException if the Api call fails + */ + @Test + public void getUserAccountQuotesTest() throws ApiException { + String userId = null; + String userSecret = null; + String symbols = null; + UUID accountId = null; + Boolean useTicker = null; + List response = api.getUserAccountQuotes(userId, userSecret, symbols, accountId) + .useTicker(useTicker) + .execute(); + // TODO: test validations + } + + /** + * Place a trade with NO validation. + * + * Places a specified trade in the specified account. + * + * @throws ApiException if the Api call fails + */ + @Test + public void placeForceOrderTest() throws ApiException { + String userId = null; + String userSecret = null; + UUID accountId = null; + ActionStrict action = null; + OrderTypeStrict orderType = null; + Double price = null; + Double stop = null; + TimeInForceStrict timeInForce = null; + Double units = null; + UUID universalSymbolId = null; + Object notionalValue = null; + AccountOrderRecord response = api.placeForceOrder(userId, userSecret) + .accountId(accountId) + .action(action) + .orderType(orderType) + .price(price) + .stop(stop) + .timeInForce(timeInForce) + .units(units) + .universalSymbolId(universalSymbolId) + .notionalValue(notionalValue) + .execute(); + // TODO: test validations + } + + /** + * Place order + * + * Places the specified trade object. This places the order in the account and returns the status of the order from the brokerage. + * + * @throws ApiException if the Api call fails + */ + @Test + public void placeOrderTest() throws ApiException { + UUID tradeId = null; + String userId = null; + String userSecret = null; + Boolean waitToConfirm = null; + AccountOrderRecord response = api.placeOrder(tradeId, userId, userSecret) + .waitToConfirm(waitToConfirm) + .execute(); + // TODO: test validations + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/api/TransactionsAndReportingApiTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/api/TransactionsAndReportingApiTest.java new file mode 100644 index 0000000000..9566d0e039 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/api/TransactionsAndReportingApiTest.java @@ -0,0 +1,96 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.api; + +import com.konfigthis.client.ApiException; +import com.konfigthis.client.ApiClient; +import com.konfigthis.client.ApiException; +import com.konfigthis.client.Configuration; +import java.time.LocalDate; +import com.konfigthis.client.model.PerformanceCustom; +import com.konfigthis.client.model.UniversalActivity; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.BeforeAll; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for TransactionsAndReportingApi + */ +@Disabled +public class TransactionsAndReportingApiTest { + + private static TransactionsAndReportingApi api; + + + @BeforeAll + public static void beforeClass() { + ApiClient apiClient = Configuration.getDefaultApiClient(); + api = new TransactionsAndReportingApi(apiClient); + } + + /** + * Get transaction history for a user + * + * Returns activities (transactions) for a user. Specifying start and end date is highly recommended for better performance + * + * @throws ApiException if the Api call fails + */ + @Test + public void getActivitiesTest() throws ApiException { + String userId = null; + String userSecret = null; + LocalDate startDate = null; + LocalDate endDate = null; + String accounts = null; + String brokerageAuthorizations = null; + String type = null; + List response = api.getActivities(userId, userSecret) + .startDate(startDate) + .endDate(endDate) + .accounts(accounts) + .brokerageAuthorizations(brokerageAuthorizations) + .type(type) + .execute(); + // TODO: test validations + } + + /** + * Get performance information for a specific timeframe + * + * Returns performance information (contributions, dividends, rate of return, etc) for a specific timeframe. Please note that Total Equity Timeframe and Rate of Returns are experimental features. Please contact support@snaptrade.com if you notice any inconsistencies. + * + * @throws ApiException if the Api call fails + */ + @Test + public void getReportingCustomRangeTest() throws ApiException { + LocalDate startDate = null; + LocalDate endDate = null; + String userId = null; + String userSecret = null; + String accounts = null; + Boolean detailed = null; + String frequency = null; + PerformanceCustom response = api.getReportingCustomRange(startDate, endDate, userId, userSecret) + .accounts(accounts) + .detailed(detailed) + .frequency(frequency) + .execute(); + // TODO: test validations + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/AccountBalanceNullableTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/AccountBalanceNullableTest.java new file mode 100644 index 0000000000..4bfefd392f --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/AccountBalanceNullableTest.java @@ -0,0 +1,51 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.AmountNullable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for AccountBalanceNullable + */ +public class AccountBalanceNullableTest { + private final AccountBalanceNullable model = new AccountBalanceNullable(); + + /** + * Model tests for AccountBalanceNullable + */ + @Test + public void testAccountBalanceNullable() { + // TODO: test AccountBalanceNullable + } + + /** + * Test the property 'total' + */ + @Test + public void totalTest() { + // TODO: test total + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/AccountBalanceTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/AccountBalanceTest.java new file mode 100644 index 0000000000..d8cf137ecb --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/AccountBalanceTest.java @@ -0,0 +1,51 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.AmountNullable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for AccountBalance + */ +public class AccountBalanceTest { + private final AccountBalance model = new AccountBalance(); + + /** + * Model tests for AccountBalance + */ + @Test + public void testAccountBalance() { + // TODO: test AccountBalance + } + + /** + * Test the property 'total' + */ + @Test + public void totalTest() { + // TODO: test total + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/AccountHoldingsAccountTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/AccountHoldingsAccountTest.java new file mode 100644 index 0000000000..9ce9f96208 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/AccountHoldingsAccountTest.java @@ -0,0 +1,98 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.AccountOrderRecord; +import com.konfigthis.client.model.Balance; +import com.konfigthis.client.model.OptionsPosition; +import com.konfigthis.client.model.Position; +import com.konfigthis.client.model.SnapTradeHoldingsAccountAccountId; +import com.konfigthis.client.model.SnapTradeHoldingsTotalValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for AccountHoldingsAccount + */ +public class AccountHoldingsAccountTest { + private final AccountHoldingsAccount model = new AccountHoldingsAccount(); + + /** + * Model tests for AccountHoldingsAccount + */ + @Test + public void testAccountHoldingsAccount() { + // TODO: test AccountHoldingsAccount + } + + /** + * Test the property 'account' + */ + @Test + public void accountTest() { + // TODO: test account + } + + /** + * Test the property 'balances' + */ + @Test + public void balancesTest() { + // TODO: test balances + } + + /** + * Test the property 'positions' + */ + @Test + public void positionsTest() { + // TODO: test positions + } + + /** + * Test the property 'optionPositions' + */ + @Test + public void optionPositionsTest() { + // TODO: test optionPositions + } + + /** + * Test the property 'orders' + */ + @Test + public void ordersTest() { + // TODO: test orders + } + + /** + * Test the property 'totalValue' + */ + @Test + public void totalValueTest() { + // TODO: test totalValue + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/AccountHoldingsTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/AccountHoldingsTest.java new file mode 100644 index 0000000000..71b57870cf --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/AccountHoldingsTest.java @@ -0,0 +1,80 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.Balance; +import com.konfigthis.client.model.Position; +import com.konfigthis.client.model.SnapTradeHoldingsAccount; +import com.konfigthis.client.model.SnapTradeHoldingsTotalValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for AccountHoldings + */ +public class AccountHoldingsTest { + private final AccountHoldings model = new AccountHoldings(); + + /** + * Model tests for AccountHoldings + */ + @Test + public void testAccountHoldings() { + // TODO: test AccountHoldings + } + + /** + * Test the property 'account' + */ + @Test + public void accountTest() { + // TODO: test account + } + + /** + * Test the property 'balances' + */ + @Test + public void balancesTest() { + // TODO: test balances + } + + /** + * Test the property 'positions' + */ + @Test + public void positionsTest() { + // TODO: test positions + } + + /** + * Test the property 'totalValue' + */ + @Test + public void totalValueTest() { + // TODO: test totalValue + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/AccountOrderRecordStatusTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/AccountOrderRecordStatusTest.java new file mode 100644 index 0000000000..b258d2f109 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/AccountOrderRecordStatusTest.java @@ -0,0 +1,32 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.annotations.SerializedName; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for AccountOrderRecordStatus + */ +public class AccountOrderRecordStatusTest { + /** + * Model tests for AccountOrderRecordStatus + */ + @Test + public void testAccountOrderRecordStatus() { + // TODO: test AccountOrderRecordStatus + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/AccountOrderRecordTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/AccountOrderRecordTest.java new file mode 100644 index 0000000000..a069f03338 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/AccountOrderRecordTest.java @@ -0,0 +1,198 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.AccountOrderRecordStatus; +import com.konfigthis.client.model.OptionsSymbol; +import com.konfigthis.client.model.UniversalSymbol; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for AccountOrderRecord + */ +public class AccountOrderRecordTest { + private final AccountOrderRecord model = new AccountOrderRecord(); + + /** + * Model tests for AccountOrderRecord + */ + @Test + public void testAccountOrderRecord() { + // TODO: test AccountOrderRecord + } + + /** + * Test the property 'brokerageOrderId' + */ + @Test + public void brokerageOrderIdTest() { + // TODO: test brokerageOrderId + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'symbol' + */ + @Test + public void symbolTest() { + // TODO: test symbol + } + + /** + * Test the property 'universalSymbol' + */ + @Test + public void universalSymbolTest() { + // TODO: test universalSymbol + } + + /** + * Test the property 'optionSymbol' + */ + @Test + public void optionSymbolTest() { + // TODO: test optionSymbol + } + + /** + * Test the property 'action' + */ + @Test + public void actionTest() { + // TODO: test action + } + + /** + * Test the property 'totalQuantity' + */ + @Test + public void totalQuantityTest() { + // TODO: test totalQuantity + } + + /** + * Test the property 'openQuantity' + */ + @Test + public void openQuantityTest() { + // TODO: test openQuantity + } + + /** + * Test the property 'canceledQuantity' + */ + @Test + public void canceledQuantityTest() { + // TODO: test canceledQuantity + } + + /** + * Test the property 'filledQuantity' + */ + @Test + public void filledQuantityTest() { + // TODO: test filledQuantity + } + + /** + * Test the property 'executionPrice' + */ + @Test + public void executionPriceTest() { + // TODO: test executionPrice + } + + /** + * Test the property 'limitPrice' + */ + @Test + public void limitPriceTest() { + // TODO: test limitPrice + } + + /** + * Test the property 'stopPrice' + */ + @Test + public void stopPriceTest() { + // TODO: test stopPrice + } + + /** + * Test the property 'orderType' + */ + @Test + public void orderTypeTest() { + // TODO: test orderType + } + + /** + * Test the property 'timeInForce' + */ + @Test + public void timeInForceTest() { + // TODO: test timeInForce + } + + /** + * Test the property 'timePlaced' + */ + @Test + public void timePlacedTest() { + // TODO: test timePlaced + } + + /** + * Test the property 'timeUpdated' + */ + @Test + public void timeUpdatedTest() { + // TODO: test timeUpdated + } + + /** + * Test the property 'timeExecuted' + */ + @Test + public void timeExecutedTest() { + // TODO: test timeExecuted + } + + /** + * Test the property 'expiryDate' + */ + @Test + public void expiryDateTest() { + // TODO: test expiryDate + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/AccountSimpleTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/AccountSimpleTest.java new file mode 100644 index 0000000000..bd4789e1f0 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/AccountSimpleTest.java @@ -0,0 +1,75 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.AccountSyncStatus; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for AccountSimple + */ +public class AccountSimpleTest { + private final AccountSimple model = new AccountSimple(); + + /** + * Model tests for AccountSimple + */ + @Test + public void testAccountSimple() { + // TODO: test AccountSimple + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'number' + */ + @Test + public void numberTest() { + // TODO: test number + } + + /** + * Test the property 'syncStatus' + */ + @Test + public void syncStatusTest() { + // TODO: test syncStatus + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/AccountSyncStatusTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/AccountSyncStatusTest.java new file mode 100644 index 0000000000..75311be072 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/AccountSyncStatusTest.java @@ -0,0 +1,59 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.HoldingsStatus; +import com.konfigthis.client.model.TransactionsStatus; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for AccountSyncStatus + */ +public class AccountSyncStatusTest { + private final AccountSyncStatus model = new AccountSyncStatus(); + + /** + * Model tests for AccountSyncStatus + */ + @Test + public void testAccountSyncStatus() { + // TODO: test AccountSyncStatus + } + + /** + * Test the property 'transactions' + */ + @Test + public void transactionsTest() { + // TODO: test transactions + } + + /** + * Test the property 'holdings' + */ + @Test + public void holdingsTest() { + // TODO: test holdings + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/AccountTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/AccountTest.java new file mode 100644 index 0000000000..1d90bfd473 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/AccountTest.java @@ -0,0 +1,137 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.AccountBalance; +import com.konfigthis.client.model.AccountSyncStatus; +import com.konfigthis.client.model.CashRestriction; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for Account + */ +public class AccountTest { + private final Account model = new Account(); + + /** + * Model tests for Account + */ + @Test + public void testAccount() { + // TODO: test Account + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'brokerageAuthorization' + */ + @Test + public void brokerageAuthorizationTest() { + // TODO: test brokerageAuthorization + } + + /** + * Test the property 'portfolioGroup' + */ + @Test + public void portfolioGroupTest() { + // TODO: test portfolioGroup + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'number' + */ + @Test + public void numberTest() { + // TODO: test number + } + + /** + * Test the property 'institutionName' + */ + @Test + public void institutionNameTest() { + // TODO: test institutionName + } + + /** + * Test the property 'createdDate' + */ + @Test + public void createdDateTest() { + // TODO: test createdDate + } + + /** + * Test the property 'meta' + */ + @Test + public void metaTest() { + // TODO: test meta + } + + /** + * Test the property 'cashRestrictions' + */ + @Test + public void cashRestrictionsTest() { + // TODO: test cashRestrictions + } + + /** + * Test the property 'syncStatus' + */ + @Test + public void syncStatusTest() { + // TODO: test syncStatus + } + + /** + * Test the property 'balance' + */ + @Test + public void balanceTest() { + // TODO: test balance + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ActionStrictTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ActionStrictTest.java new file mode 100644 index 0000000000..9827cbc884 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ActionStrictTest.java @@ -0,0 +1,33 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import io.swagger.annotations.ApiModel; +import com.google.gson.annotations.SerializedName; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for ActionStrict + */ +public class ActionStrictTest { + /** + * Model tests for ActionStrict + */ + @Test + public void testActionStrict() { + // TODO: test ActionStrict + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/AmountNullableTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/AmountNullableTest.java new file mode 100644 index 0000000000..a87f037a86 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/AmountNullableTest.java @@ -0,0 +1,57 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for AmountNullable + */ +public class AmountNullableTest { + private final AmountNullable model = new AmountNullable(); + + /** + * Model tests for AmountNullable + */ + @Test + public void testAmountNullable() { + // TODO: test AmountNullable + } + + /** + * Test the property 'amount' + */ + @Test + public void amountTest() { + // TODO: test amount + } + + /** + * Test the property 'currency' + */ + @Test + public void currencyTest() { + // TODO: test currency + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/AmountTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/AmountTest.java new file mode 100644 index 0000000000..e387bf9d73 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/AmountTest.java @@ -0,0 +1,57 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for Amount + */ +public class AmountTest { + private final Amount model = new Amount(); + + /** + * Model tests for Amount + */ + @Test + public void testAmount() { + // TODO: test Amount + } + + /** + * Test the property 'amount' + */ + @Test + public void amountTest() { + // TODO: test amount + } + + /** + * Test the property 'currency' + */ + @Test + public void currencyTest() { + // TODO: test currency + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/BalanceTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/BalanceTest.java new file mode 100644 index 0000000000..8361c6f692 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/BalanceTest.java @@ -0,0 +1,67 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.Currency; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for Balance + */ +public class BalanceTest { + private final Balance model = new Balance(); + + /** + * Model tests for Balance + */ + @Test + public void testBalance() { + // TODO: test Balance + } + + /** + * Test the property 'currency' + */ + @Test + public void currencyTest() { + // TODO: test currency + } + + /** + * Test the property 'cash' + */ + @Test + public void cashTest() { + // TODO: test cash + } + + /** + * Test the property 'buyingPower' + */ + @Test + public void buyingPowerTest() { + // TODO: test buyingPower + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/BrokerageAuthorizationDisabledConfirmationTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/BrokerageAuthorizationDisabledConfirmationTest.java new file mode 100644 index 0000000000..024a3890f9 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/BrokerageAuthorizationDisabledConfirmationTest.java @@ -0,0 +1,49 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for BrokerageAuthorizationDisabledConfirmation + */ +public class BrokerageAuthorizationDisabledConfirmationTest { + private final BrokerageAuthorizationDisabledConfirmation model = new BrokerageAuthorizationDisabledConfirmation(); + + /** + * Model tests for BrokerageAuthorizationDisabledConfirmation + */ + @Test + public void testBrokerageAuthorizationDisabledConfirmation() { + // TODO: test BrokerageAuthorizationDisabledConfirmation + } + + /** + * Test the property 'detail' + */ + @Test + public void detailTest() { + // TODO: test detail + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/BrokerageAuthorizationRefreshConfirmationTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/BrokerageAuthorizationRefreshConfirmationTest.java new file mode 100644 index 0000000000..61d6029b67 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/BrokerageAuthorizationRefreshConfirmationTest.java @@ -0,0 +1,49 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for BrokerageAuthorizationRefreshConfirmation + */ +public class BrokerageAuthorizationRefreshConfirmationTest { + private final BrokerageAuthorizationRefreshConfirmation model = new BrokerageAuthorizationRefreshConfirmation(); + + /** + * Model tests for BrokerageAuthorizationRefreshConfirmation + */ + @Test + public void testBrokerageAuthorizationRefreshConfirmation() { + // TODO: test BrokerageAuthorizationRefreshConfirmation + } + + /** + * Test the property 'detail' + */ + @Test + public void detailTest() { + // TODO: test detail + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/BrokerageAuthorizationTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/BrokerageAuthorizationTest.java new file mode 100644 index 0000000000..96116a1feb --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/BrokerageAuthorizationTest.java @@ -0,0 +1,118 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.Brokerage; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for BrokerageAuthorization + */ +public class BrokerageAuthorizationTest { + private final BrokerageAuthorization model = new BrokerageAuthorization(); + + /** + * Model tests for BrokerageAuthorization + */ + @Test + public void testBrokerageAuthorization() { + // TODO: test BrokerageAuthorization + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'createdDate' + */ + @Test + public void createdDateTest() { + // TODO: test createdDate + } + + /** + * Test the property 'updatedDate' + */ + @Test + public void updatedDateTest() { + // TODO: test updatedDate + } + + /** + * Test the property 'brokerage' + */ + @Test + public void brokerageTest() { + // TODO: test brokerage + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'disabled' + */ + @Test + public void disabledTest() { + // TODO: test disabled + } + + /** + * Test the property 'disabledDate' + */ + @Test + public void disabledDateTest() { + // TODO: test disabledDate + } + + /** + * Test the property 'meta' + */ + @Test + public void metaTest() { + // TODO: test meta + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/BrokerageAuthorizationTypeReadOnlyBrokerageTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/BrokerageAuthorizationTypeReadOnlyBrokerageTest.java new file mode 100644 index 0000000000..34aae111a8 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/BrokerageAuthorizationTypeReadOnlyBrokerageTest.java @@ -0,0 +1,66 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for BrokerageAuthorizationTypeReadOnlyBrokerage + */ +public class BrokerageAuthorizationTypeReadOnlyBrokerageTest { + private final BrokerageAuthorizationTypeReadOnlyBrokerage model = new BrokerageAuthorizationTypeReadOnlyBrokerage(); + + /** + * Model tests for BrokerageAuthorizationTypeReadOnlyBrokerage + */ + @Test + public void testBrokerageAuthorizationTypeReadOnlyBrokerage() { + // TODO: test BrokerageAuthorizationTypeReadOnlyBrokerage + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'slug' + */ + @Test + public void slugTest() { + // TODO: test slug + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/BrokerageAuthorizationTypeReadOnlyTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/BrokerageAuthorizationTypeReadOnlyTest.java new file mode 100644 index 0000000000..9b0745013c --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/BrokerageAuthorizationTypeReadOnlyTest.java @@ -0,0 +1,75 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.BrokerageAuthorizationTypeReadOnlyBrokerage; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for BrokerageAuthorizationTypeReadOnly + */ +public class BrokerageAuthorizationTypeReadOnlyTest { + private final BrokerageAuthorizationTypeReadOnly model = new BrokerageAuthorizationTypeReadOnly(); + + /** + * Model tests for BrokerageAuthorizationTypeReadOnly + */ + @Test + public void testBrokerageAuthorizationTypeReadOnly() { + // TODO: test BrokerageAuthorizationTypeReadOnly + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'authType' + */ + @Test + public void authTypeTest() { + // TODO: test authType + } + + /** + * Test the property 'brokerage' + */ + @Test + public void brokerageTest() { + // TODO: test brokerage + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/BrokerageAuthorizationTypeTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/BrokerageAuthorizationTypeTest.java new file mode 100644 index 0000000000..52a6d86a2f --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/BrokerageAuthorizationTypeTest.java @@ -0,0 +1,49 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for BrokerageAuthorizationType + */ +public class BrokerageAuthorizationTypeTest { + private final BrokerageAuthorizationType model = new BrokerageAuthorizationType(); + + /** + * Model tests for BrokerageAuthorizationType + */ + @Test + public void testBrokerageAuthorizationType() { + // TODO: test BrokerageAuthorizationType + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/BrokerageSymbolTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/BrokerageSymbolTest.java new file mode 100644 index 0000000000..9200f809fc --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/BrokerageSymbolTest.java @@ -0,0 +1,94 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.BrokerageAuthorization; +import com.konfigthis.client.model.OptionsSymbolNullable; +import com.konfigthis.client.model.UniversalSymbolNullable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for BrokerageSymbol + */ +public class BrokerageSymbolTest { + private final BrokerageSymbol model = new BrokerageSymbol(); + + /** + * Model tests for BrokerageSymbol + */ + @Test + public void testBrokerageSymbol() { + // TODO: test BrokerageSymbol + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'symbol' + */ + @Test + public void symbolTest() { + // TODO: test symbol + } + + /** + * Test the property 'brokerageAuthorization' + */ + @Test + public void brokerageAuthorizationTest() { + // TODO: test brokerageAuthorization + } + + /** + * Test the property 'description' + */ + @Test + public void descriptionTest() { + // TODO: test description + } + + /** + * Test the property 'allowsFractionalUnits' + */ + @Test + public void allowsFractionalUnitsTest() { + // TODO: test allowsFractionalUnits + } + + /** + * Test the property 'optionSymbol' + */ + @Test + public void optionSymbolTest() { + // TODO: test optionSymbol + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/BrokerageTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/BrokerageTest.java new file mode 100644 index 0000000000..8b440dc0ba --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/BrokerageTest.java @@ -0,0 +1,206 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.BrokerageType; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for Brokerage + */ +public class BrokerageTest { + private final Brokerage model = new Brokerage(); + + /** + * Model tests for Brokerage + */ + @Test + public void testBrokerage() { + // TODO: test Brokerage + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'displayName' + */ + @Test + public void displayNameTest() { + // TODO: test displayName + } + + /** + * Test the property 'description' + */ + @Test + public void descriptionTest() { + // TODO: test description + } + + /** + * Test the property 'awsS3LogoUrl' + */ + @Test + public void awsS3LogoUrlTest() { + // TODO: test awsS3LogoUrl + } + + /** + * Test the property 'awsS3SquareLogoUrl' + */ + @Test + public void awsS3SquareLogoUrlTest() { + // TODO: test awsS3SquareLogoUrl + } + + /** + * Test the property 'openUrl' + */ + @Test + public void openUrlTest() { + // TODO: test openUrl + } + + /** + * Test the property 'slug' + */ + @Test + public void slugTest() { + // TODO: test slug + } + + /** + * Test the property 'url' + */ + @Test + public void urlTest() { + // TODO: test url + } + + /** + * Test the property 'enabled' + */ + @Test + public void enabledTest() { + // TODO: test enabled + } + + /** + * Test the property 'maintenanceMode' + */ + @Test + public void maintenanceModeTest() { + // TODO: test maintenanceMode + } + + /** + * Test the property 'allowsFractionalUnits' + */ + @Test + public void allowsFractionalUnitsTest() { + // TODO: test allowsFractionalUnits + } + + /** + * Test the property 'allowsTrading' + */ + @Test + public void allowsTradingTest() { + // TODO: test allowsTrading + } + + /** + * Test the property 'hasReporting' + */ + @Test + public void hasReportingTest() { + // TODO: test hasReporting + } + + /** + * Test the property 'isRealTimeConnection' + */ + @Test + public void isRealTimeConnectionTest() { + // TODO: test isRealTimeConnection + } + + /** + * Test the property 'allowsTradingThroughSnaptradeApi' + */ + @Test + public void allowsTradingThroughSnaptradeApiTest() { + // TODO: test allowsTradingThroughSnaptradeApi + } + + /** + * Test the property 'isScrapingIntegration' + */ + @Test + public void isScrapingIntegrationTest() { + // TODO: test isScrapingIntegration + } + + /** + * Test the property 'defaultCurrency' + */ + @Test + public void defaultCurrencyTest() { + // TODO: test defaultCurrency + } + + /** + * Test the property 'brokerageType' + */ + @Test + public void brokerageTypeTest() { + // TODO: test brokerageType + } + + /** + * Test the property 'exchanges' + */ + @Test + public void exchangesTest() { + // TODO: test exchanges + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/BrokerageTypeTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/BrokerageTypeTest.java new file mode 100644 index 0000000000..2367395d4f --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/BrokerageTypeTest.java @@ -0,0 +1,58 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for BrokerageType + */ +public class BrokerageTypeTest { + private final BrokerageType model = new BrokerageType(); + + /** + * Model tests for BrokerageType + */ + @Test + public void testBrokerageType() { + // TODO: test BrokerageType + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/CalculatedTradeTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/CalculatedTradeTest.java new file mode 100644 index 0000000000..afa5a6d3ed --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/CalculatedTradeTest.java @@ -0,0 +1,61 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.Trade; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for CalculatedTrade + */ +public class CalculatedTradeTest { + private final CalculatedTrade model = new CalculatedTrade(); + + /** + * Model tests for CalculatedTrade + */ + @Test + public void testCalculatedTrade() { + // TODO: test CalculatedTrade + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'trades' + */ + @Test + public void tradesTest() { + // TODO: test trades + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/CashRestrictionTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/CashRestrictionTest.java new file mode 100644 index 0000000000..2c496c6696 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/CashRestrictionTest.java @@ -0,0 +1,82 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for CashRestriction + */ +public class CashRestrictionTest { + private final CashRestriction model = new CashRestriction(); + + /** + * Model tests for CashRestriction + */ + @Test + public void testCashRestriction() { + // TODO: test CashRestriction + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'account' + */ + @Test + public void accountTest() { + // TODO: test account + } + + /** + * Test the property 'currency' + */ + @Test + public void currencyTest() { + // TODO: test currency + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'amount' + */ + @Test + public void amountTest() { + // TODO: test amount + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/CurrencyNullableTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/CurrencyNullableTest.java new file mode 100644 index 0000000000..e95c06293a --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/CurrencyNullableTest.java @@ -0,0 +1,66 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for CurrencyNullable + */ +public class CurrencyNullableTest { + private final CurrencyNullable model = new CurrencyNullable(); + + /** + * Model tests for CurrencyNullable + */ + @Test + public void testCurrencyNullable() { + // TODO: test CurrencyNullable + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'code' + */ + @Test + public void codeTest() { + // TODO: test code + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/CurrencyTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/CurrencyTest.java new file mode 100644 index 0000000000..ec27a273e7 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/CurrencyTest.java @@ -0,0 +1,66 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for Currency + */ +public class CurrencyTest { + private final Currency model = new Currency(); + + /** + * Model tests for Currency + */ + @Test + public void testCurrency() { + // TODO: test Currency + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'code' + */ + @Test + public void codeTest() { + // TODO: test code + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/DeleteUserResponseTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/DeleteUserResponseTest.java new file mode 100644 index 0000000000..23b9ac402a --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/DeleteUserResponseTest.java @@ -0,0 +1,57 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for DeleteUserResponse + */ +public class DeleteUserResponseTest { + private final DeleteUserResponse model = new DeleteUserResponse(); + + /** + * Model tests for DeleteUserResponse + */ + @Test + public void testDeleteUserResponse() { + // TODO: test DeleteUserResponse + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'userId' + */ + @Test + public void userIdTest() { + // TODO: test userId + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/DividendAtDateTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/DividendAtDateTest.java new file mode 100644 index 0000000000..d73b13d29f --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/DividendAtDateTest.java @@ -0,0 +1,66 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for DividendAtDate + */ +public class DividendAtDateTest { + private final DividendAtDate model = new DividendAtDate(); + + /** + * Model tests for DividendAtDate + */ + @Test + public void testDividendAtDate() { + // TODO: test DividendAtDate + } + + /** + * Test the property 'symbol' + */ + @Test + public void symbolTest() { + // TODO: test symbol + } + + /** + * Test the property 'amount' + */ + @Test + public void amountTest() { + // TODO: test amount + } + + /** + * Test the property 'currency' + */ + @Test + public void currencyTest() { + // TODO: test currency + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/EncryptedResponseEncryptedMessageDataTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/EncryptedResponseEncryptedMessageDataTest.java new file mode 100644 index 0000000000..f814b8c5ec --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/EncryptedResponseEncryptedMessageDataTest.java @@ -0,0 +1,65 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for EncryptedResponseEncryptedMessageData + */ +public class EncryptedResponseEncryptedMessageDataTest { + private final EncryptedResponseEncryptedMessageData model = new EncryptedResponseEncryptedMessageData(); + + /** + * Model tests for EncryptedResponseEncryptedMessageData + */ + @Test + public void testEncryptedResponseEncryptedMessageData() { + // TODO: test EncryptedResponseEncryptedMessageData + } + + /** + * Test the property 'encryptedMessage' + */ + @Test + public void encryptedMessageTest() { + // TODO: test encryptedMessage + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + // TODO: test tag + } + + /** + * Test the property 'nonce' + */ + @Test + public void nonceTest() { + // TODO: test nonce + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/EncryptedResponseTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/EncryptedResponseTest.java new file mode 100644 index 0000000000..c24243800f --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/EncryptedResponseTest.java @@ -0,0 +1,58 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.EncryptedResponseEncryptedMessageData; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for EncryptedResponse + */ +public class EncryptedResponseTest { + private final EncryptedResponse model = new EncryptedResponse(); + + /** + * Model tests for EncryptedResponse + */ + @Test + public void testEncryptedResponse() { + // TODO: test EncryptedResponse + } + + /** + * Test the property 'encryptedSharedKey' + */ + @Test + public void encryptedSharedKeyTest() { + // TODO: test encryptedSharedKey + } + + /** + * Test the property 'encryptedMessageData' + */ + @Test + public void encryptedMessageDataTest() { + // TODO: test encryptedMessageData + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ExchangeRatePairsTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ExchangeRatePairsTest.java new file mode 100644 index 0000000000..412143de94 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ExchangeRatePairsTest.java @@ -0,0 +1,66 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.Currency; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for ExchangeRatePairs + */ +public class ExchangeRatePairsTest { + private final ExchangeRatePairs model = new ExchangeRatePairs(); + + /** + * Model tests for ExchangeRatePairs + */ + @Test + public void testExchangeRatePairs() { + // TODO: test ExchangeRatePairs + } + + /** + * Test the property 'src' + */ + @Test + public void srcTest() { + // TODO: test src + } + + /** + * Test the property 'dst' + */ + @Test + public void dstTest() { + // TODO: test dst + } + + /** + * Test the property 'exchangeRate' + */ + @Test + public void exchangeRateTest() { + // TODO: test exchangeRate + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ExchangeTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ExchangeTest.java new file mode 100644 index 0000000000..336b8e81a7 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ExchangeTest.java @@ -0,0 +1,107 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for Exchange + */ +public class ExchangeTest { + private final Exchange model = new Exchange(); + + /** + * Model tests for Exchange + */ + @Test + public void testExchange() { + // TODO: test Exchange + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'code' + */ + @Test + public void codeTest() { + // TODO: test code + } + + /** + * Test the property 'micCode' + */ + @Test + public void micCodeTest() { + // TODO: test micCode + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'timezone' + */ + @Test + public void timezoneTest() { + // TODO: test timezone + } + + /** + * Test the property 'startTime' + */ + @Test + public void startTimeTest() { + // TODO: test startTime + } + + /** + * Test the property 'closeTime' + */ + @Test + public void closeTimeTest() { + // TODO: test closeTime + } + + /** + * Test the property 'suffix' + */ + @Test + public void suffixTest() { + // TODO: test suffix + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ExcludedAssetTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ExcludedAssetTest.java new file mode 100644 index 0000000000..5fe84e2bad --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ExcludedAssetTest.java @@ -0,0 +1,50 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.UniversalSymbol; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for ExcludedAsset + */ +public class ExcludedAssetTest { + private final ExcludedAsset model = new ExcludedAsset(); + + /** + * Model tests for ExcludedAsset + */ + @Test + public void testExcludedAsset() { + // TODO: test ExcludedAsset + } + + /** + * Test the property 'symbol' + */ + @Test + public void symbolTest() { + // TODO: test symbol + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/FigiInstrumentNullableTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/FigiInstrumentNullableTest.java new file mode 100644 index 0000000000..ff400fe7f3 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/FigiInstrumentNullableTest.java @@ -0,0 +1,58 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for FigiInstrumentNullable + */ +public class FigiInstrumentNullableTest { + private final FigiInstrumentNullable model = new FigiInstrumentNullable(); + + /** + * Model tests for FigiInstrumentNullable + */ + @Test + public void testFigiInstrumentNullable() { + // TODO: test FigiInstrumentNullable + } + + /** + * Test the property 'figiCode' + */ + @Test + public void figiCodeTest() { + // TODO: test figiCode + } + + /** + * Test the property 'figiShareClass' + */ + @Test + public void figiShareClassTest() { + // TODO: test figiShareClass + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/FigiInstrumentTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/FigiInstrumentTest.java new file mode 100644 index 0000000000..491d25be69 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/FigiInstrumentTest.java @@ -0,0 +1,58 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for FigiInstrument + */ +public class FigiInstrumentTest { + private final FigiInstrument model = new FigiInstrument(); + + /** + * Model tests for FigiInstrument + */ + @Test + public void testFigiInstrument() { + // TODO: test FigiInstrument + } + + /** + * Test the property 'figiCode' + */ + @Test + public void figiCodeTest() { + // TODO: test figiCode + } + + /** + * Test the property 'figiShareClass' + */ + @Test + public void figiShareClassTest() { + // TODO: test figiShareClass + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/HoldingsStatusTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/HoldingsStatusTest.java new file mode 100644 index 0000000000..f92e7b0310 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/HoldingsStatusTest.java @@ -0,0 +1,58 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for HoldingsStatus + */ +public class HoldingsStatusTest { + private final HoldingsStatus model = new HoldingsStatus(); + + /** + * Model tests for HoldingsStatus + */ + @Test + public void testHoldingsStatus() { + // TODO: test HoldingsStatus + } + + /** + * Test the property 'initialSyncCompleted' + */ + @Test + public void initialSyncCompletedTest() { + // TODO: test initialSyncCompleted + } + + /** + * Test the property 'lastSuccessfulSync' + */ + @Test + public void lastSuccessfulSyncTest() { + // TODO: test lastSuccessfulSync + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/JWTTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/JWTTest.java new file mode 100644 index 0000000000..ca8b58ff8e --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/JWTTest.java @@ -0,0 +1,49 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for JWT + */ +public class JWTTest { + private final JWT model = new JWT(); + + /** + * Model tests for JWT + */ + @Test + public void testJWT() { + // TODO: test JWT + } + + /** + * Test the property 'token' + */ + @Test + public void tokenTest() { + // TODO: test token + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/LoginRedirectURITest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/LoginRedirectURITest.java new file mode 100644 index 0000000000..78557b6dba --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/LoginRedirectURITest.java @@ -0,0 +1,58 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for LoginRedirectURI + */ +public class LoginRedirectURITest { + private final LoginRedirectURI model = new LoginRedirectURI(); + + /** + * Model tests for LoginRedirectURI + */ + @Test + public void testLoginRedirectURI() { + // TODO: test LoginRedirectURI + } + + /** + * Test the property 'redirectURI' + */ + @Test + public void redirectURITest() { + // TODO: test redirectURI + } + + /** + * Test the property 'sessionId' + */ + @Test + public void sessionIdTest() { + // TODO: test sessionId + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ManualTradeAndImpactTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ManualTradeAndImpactTest.java new file mode 100644 index 0000000000..72560df763 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ManualTradeAndImpactTest.java @@ -0,0 +1,69 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.ManualTrade; +import com.konfigthis.client.model.ManualTradeBalance; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for ManualTradeAndImpact + */ +public class ManualTradeAndImpactTest { + private final ManualTradeAndImpact model = new ManualTradeAndImpact(); + + /** + * Model tests for ManualTradeAndImpact + */ + @Test + public void testManualTradeAndImpact() { + // TODO: test ManualTradeAndImpact + } + + /** + * Test the property 'trade' + */ + @Test + public void tradeTest() { + // TODO: test trade + } + + /** + * Test the property 'tradeImpacts' + */ + @Test + public void tradeImpactsTest() { + // TODO: test tradeImpacts + } + + /** + * Test the property 'combinedRemainingBalance' + */ + @Test + public void combinedRemainingBalanceTest() { + // TODO: test combinedRemainingBalance + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ManualTradeBalanceTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ManualTradeBalanceTest.java new file mode 100644 index 0000000000..901e189992 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ManualTradeBalanceTest.java @@ -0,0 +1,68 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.Account; +import com.konfigthis.client.model.Currency; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for ManualTradeBalance + */ +public class ManualTradeBalanceTest { + private final ManualTradeBalance model = new ManualTradeBalance(); + + /** + * Model tests for ManualTradeBalance + */ + @Test + public void testManualTradeBalance() { + // TODO: test ManualTradeBalance + } + + /** + * Test the property 'account' + */ + @Test + public void accountTest() { + // TODO: test account + } + + /** + * Test the property 'currency' + */ + @Test + public void currencyTest() { + // TODO: test currency + } + + /** + * Test the property 'cash' + */ + @Test + public void cashTest() { + // TODO: test cash + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ManualTradeFormTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ManualTradeFormTest.java new file mode 100644 index 0000000000..7585f285c7 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ManualTradeFormTest.java @@ -0,0 +1,118 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.ActionStrict; +import com.konfigthis.client.model.OrderTypeStrict; +import com.konfigthis.client.model.TimeInForceStrict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for ManualTradeForm + */ +public class ManualTradeFormTest { + private final ManualTradeForm model = new ManualTradeForm(); + + /** + * Model tests for ManualTradeForm + */ + @Test + public void testManualTradeForm() { + // TODO: test ManualTradeForm + } + + /** + * Test the property 'accountId' + */ + @Test + public void accountIdTest() { + // TODO: test accountId + } + + /** + * Test the property 'action' + */ + @Test + public void actionTest() { + // TODO: test action + } + + /** + * Test the property 'orderType' + */ + @Test + public void orderTypeTest() { + // TODO: test orderType + } + + /** + * Test the property 'price' + */ + @Test + public void priceTest() { + // TODO: test price + } + + /** + * Test the property 'stop' + */ + @Test + public void stopTest() { + // TODO: test stop + } + + /** + * Test the property 'timeInForce' + */ + @Test + public void timeInForceTest() { + // TODO: test timeInForce + } + + /** + * Test the property 'units' + */ + @Test + public void unitsTest() { + // TODO: test units + } + + /** + * Test the property 'universalSymbolId' + */ + @Test + public void universalSymbolIdTest() { + // TODO: test universalSymbolId + } + + /** + * Test the property 'notionalValue' + */ + @Test + public void notionalValueTest() { + // TODO: test notionalValue + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ManualTradeSymbolTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ManualTradeSymbolTest.java new file mode 100644 index 0000000000..6606317c35 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ManualTradeSymbolTest.java @@ -0,0 +1,92 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.Currency; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for ManualTradeSymbol + */ +public class ManualTradeSymbolTest { + private final ManualTradeSymbol model = new ManualTradeSymbol(); + + /** + * Model tests for ManualTradeSymbol + */ + @Test + public void testManualTradeSymbol() { + // TODO: test ManualTradeSymbol + } + + /** + * Test the property 'brokerageSymbolId' + */ + @Test + public void brokerageSymbolIdTest() { + // TODO: test brokerageSymbolId + } + + /** + * Test the property 'universalSymbolId' + */ + @Test + public void universalSymbolIdTest() { + // TODO: test universalSymbolId + } + + /** + * Test the property 'currency' + */ + @Test + public void currencyTest() { + // TODO: test currency + } + + /** + * Test the property 'localId' + */ + @Test + public void localIdTest() { + // TODO: test localId + } + + /** + * Test the property 'description' + */ + @Test + public void descriptionTest() { + // TODO: test description + } + + /** + * Test the property 'symbol' + */ + @Test + public void symbolTest() { + // TODO: test symbol + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ManualTradeTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ManualTradeTest.java new file mode 100644 index 0000000000..2cae5e64cb --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ManualTradeTest.java @@ -0,0 +1,110 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.ActionStrict; +import com.konfigthis.client.model.ManualTradeSymbol; +import com.konfigthis.client.model.OrderTypeStrict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for ManualTrade + */ +public class ManualTradeTest { + private final ManualTrade model = new ManualTrade(); + + /** + * Model tests for ManualTrade + */ + @Test + public void testManualTrade() { + // TODO: test ManualTrade + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'account' + */ + @Test + public void accountTest() { + // TODO: test account + } + + /** + * Test the property 'orderType' + */ + @Test + public void orderTypeTest() { + // TODO: test orderType + } + + /** + * Test the property 'timeInForce' + */ + @Test + public void timeInForceTest() { + // TODO: test timeInForce + } + + /** + * Test the property 'symbol' + */ + @Test + public void symbolTest() { + // TODO: test symbol + } + + /** + * Test the property 'action' + */ + @Test + public void actionTest() { + // TODO: test action + } + + /** + * Test the property 'units' + */ + @Test + public void unitsTest() { + // TODO: test units + } + + /** + * Test the property 'price' + */ + @Test + public void priceTest() { + // TODO: test price + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ModelAssetClassDetailsTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ModelAssetClassDetailsTest.java new file mode 100644 index 0000000000..be1c90184f --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ModelAssetClassDetailsTest.java @@ -0,0 +1,61 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.ModelAssetClass; +import com.konfigthis.client.model.ModelAssetClassTarget; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for ModelAssetClassDetails + */ +public class ModelAssetClassDetailsTest { + private final ModelAssetClassDetails model = new ModelAssetClassDetails(); + + /** + * Model tests for ModelAssetClassDetails + */ + @Test + public void testModelAssetClassDetails() { + // TODO: test ModelAssetClassDetails + } + + /** + * Test the property 'modelAssetClass' + */ + @Test + public void modelAssetClassTest() { + // TODO: test modelAssetClass + } + + /** + * Test the property 'modelAssetClassTarget' + */ + @Test + public void modelAssetClassTargetTest() { + // TODO: test modelAssetClassTarget + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ModelAssetClassTargetTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ModelAssetClassTargetTest.java new file mode 100644 index 0000000000..51227a6236 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ModelAssetClassTargetTest.java @@ -0,0 +1,50 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.UniversalSymbol; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for ModelAssetClassTarget + */ +public class ModelAssetClassTargetTest { + private final ModelAssetClassTarget model = new ModelAssetClassTarget(); + + /** + * Model tests for ModelAssetClassTarget + */ + @Test + public void testModelAssetClassTarget() { + // TODO: test ModelAssetClassTarget + } + + /** + * Test the property 'symbol' + */ + @Test + public void symbolTest() { + // TODO: test symbol + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ModelAssetClassTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ModelAssetClassTest.java new file mode 100644 index 0000000000..830324d8ef --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ModelAssetClassTest.java @@ -0,0 +1,58 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for ModelAssetClass + */ +public class ModelAssetClassTest { + private final ModelAssetClass model = new ModelAssetClass(); + + /** + * Model tests for ModelAssetClass + */ + @Test + public void testModelAssetClass() { + // TODO: test ModelAssetClass + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ModelPortfolioAssetClassTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ModelPortfolioAssetClassTest.java new file mode 100644 index 0000000000..6f17194b64 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ModelPortfolioAssetClassTest.java @@ -0,0 +1,58 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.ModelAssetClass; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for ModelPortfolioAssetClass + */ +public class ModelPortfolioAssetClassTest { + private final ModelPortfolioAssetClass model = new ModelPortfolioAssetClass(); + + /** + * Model tests for ModelPortfolioAssetClass + */ + @Test + public void testModelPortfolioAssetClass() { + // TODO: test ModelPortfolioAssetClass + } + + /** + * Test the property 'modelAssetClass' + */ + @Test + public void modelAssetClassTest() { + // TODO: test modelAssetClass + } + + /** + * Test the property 'percent' + */ + @Test + public void percentTest() { + // TODO: test percent + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ModelPortfolioDetailsTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ModelPortfolioDetailsTest.java new file mode 100644 index 0000000000..5bef41682d --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ModelPortfolioDetailsTest.java @@ -0,0 +1,70 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.ModelPortfolio; +import com.konfigthis.client.model.ModelPortfolioAssetClass; +import com.konfigthis.client.model.ModelPortfolioSecurity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for ModelPortfolioDetails + */ +public class ModelPortfolioDetailsTest { + private final ModelPortfolioDetails model = new ModelPortfolioDetails(); + + /** + * Model tests for ModelPortfolioDetails + */ + @Test + public void testModelPortfolioDetails() { + // TODO: test ModelPortfolioDetails + } + + /** + * Test the property 'modelPortfolio' + */ + @Test + public void modelPortfolioTest() { + // TODO: test modelPortfolio + } + + /** + * Test the property 'modelPortfolioSecurity' + */ + @Test + public void modelPortfolioSecurityTest() { + // TODO: test modelPortfolioSecurity + } + + /** + * Test the property 'modelPortfolioAssetClass' + */ + @Test + public void modelPortfolioAssetClassTest() { + // TODO: test modelPortfolioAssetClass + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ModelPortfolioSecurityTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ModelPortfolioSecurityTest.java new file mode 100644 index 0000000000..8e2c69d677 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ModelPortfolioSecurityTest.java @@ -0,0 +1,58 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.UniversalSymbol; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for ModelPortfolioSecurity + */ +public class ModelPortfolioSecurityTest { + private final ModelPortfolioSecurity model = new ModelPortfolioSecurity(); + + /** + * Model tests for ModelPortfolioSecurity + */ + @Test + public void testModelPortfolioSecurity() { + // TODO: test ModelPortfolioSecurity + } + + /** + * Test the property 'symbol' + */ + @Test + public void symbolTest() { + // TODO: test symbol + } + + /** + * Test the property 'percent' + */ + @Test + public void percentTest() { + // TODO: test percent + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ModelPortfolioTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ModelPortfolioTest.java new file mode 100644 index 0000000000..5fd0848257 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ModelPortfolioTest.java @@ -0,0 +1,66 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for ModelPortfolio + */ +public class ModelPortfolioTest { + private final ModelPortfolio model = new ModelPortfolio(); + + /** + * Model tests for ModelPortfolio + */ + @Test + public void testModelPortfolio() { + // TODO: test ModelPortfolio + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'modelType' + */ + @Test + public void modelTypeTest() { + // TODO: test modelType + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/MonthlyDividendsTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/MonthlyDividendsTest.java new file mode 100644 index 0000000000..f15dd91cee --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/MonthlyDividendsTest.java @@ -0,0 +1,61 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.DividendAtDate; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for MonthlyDividends + */ +public class MonthlyDividendsTest { + private final MonthlyDividends model = new MonthlyDividends(); + + /** + * Model tests for MonthlyDividends + */ + @Test + public void testMonthlyDividends() { + // TODO: test MonthlyDividends + } + + /** + * Test the property 'date' + */ + @Test + public void dateTest() { + // TODO: test date + } + + /** + * Test the property 'dividends' + */ + @Test + public void dividendsTest() { + // TODO: test dividends + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/NetContributionsTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/NetContributionsTest.java new file mode 100644 index 0000000000..4c5aea7ee8 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/NetContributionsTest.java @@ -0,0 +1,67 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.time.LocalDate; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for NetContributions + */ +public class NetContributionsTest { + private final NetContributions model = new NetContributions(); + + /** + * Model tests for NetContributions + */ + @Test + public void testNetContributions() { + // TODO: test NetContributions + } + + /** + * Test the property 'date' + */ + @Test + public void dateTest() { + // TODO: test date + } + + /** + * Test the property 'contributions' + */ + @Test + public void contributionsTest() { + // TODO: test contributions + } + + /** + * Test the property 'currency' + */ + @Test + public void currencyTest() { + // TODO: test currency + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/NetDividendTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/NetDividendTest.java new file mode 100644 index 0000000000..1a56dd127e --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/NetDividendTest.java @@ -0,0 +1,67 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.UniversalSymbol; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for NetDividend + */ +public class NetDividendTest { + private final NetDividend model = new NetDividend(); + + /** + * Model tests for NetDividend + */ + @Test + public void testNetDividend() { + // TODO: test NetDividend + } + + /** + * Test the property 'symbol' + */ + @Test + public void symbolTest() { + // TODO: test symbol + } + + /** + * Test the property 'amount' + */ + @Test + public void amountTest() { + // TODO: test amount + } + + /** + * Test the property 'currency' + */ + @Test + public void currencyTest() { + // TODO: test currency + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/OptionBrokerageSymbolTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/OptionBrokerageSymbolTest.java new file mode 100644 index 0000000000..74339d24a8 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/OptionBrokerageSymbolTest.java @@ -0,0 +1,67 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.OptionsSymbol; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for OptionBrokerageSymbol + */ +public class OptionBrokerageSymbolTest { + private final OptionBrokerageSymbol model = new OptionBrokerageSymbol(); + + /** + * Model tests for OptionBrokerageSymbol + */ + @Test + public void testOptionBrokerageSymbol() { + // TODO: test OptionBrokerageSymbol + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'description' + */ + @Test + public void descriptionTest() { + // TODO: test description + } + + /** + * Test the property 'optionSymbol' + */ + @Test + public void optionSymbolTest() { + // TODO: test optionSymbol + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/OptionChainInnerChainPerRootInnerChainPerStrikePriceInnerTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/OptionChainInnerChainPerRootInnerChainPerStrikePriceInnerTest.java new file mode 100644 index 0000000000..a3e5bd3bee --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/OptionChainInnerChainPerRootInnerChainPerStrikePriceInnerTest.java @@ -0,0 +1,66 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for OptionChainInnerChainPerRootInnerChainPerStrikePriceInner + */ +public class OptionChainInnerChainPerRootInnerChainPerStrikePriceInnerTest { + private final OptionChainInnerChainPerRootInnerChainPerStrikePriceInner model = new OptionChainInnerChainPerRootInnerChainPerStrikePriceInner(); + + /** + * Model tests for OptionChainInnerChainPerRootInnerChainPerStrikePriceInner + */ + @Test + public void testOptionChainInnerChainPerRootInnerChainPerStrikePriceInner() { + // TODO: test OptionChainInnerChainPerRootInnerChainPerStrikePriceInner + } + + /** + * Test the property 'strikePrice' + */ + @Test + public void strikePriceTest() { + // TODO: test strikePrice + } + + /** + * Test the property 'callSymbolId' + */ + @Test + public void callSymbolIdTest() { + // TODO: test callSymbolId + } + + /** + * Test the property 'putSymbolId' + */ + @Test + public void putSymbolIdTest() { + // TODO: test putSymbolId + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/OptionChainInnerChainPerRootInnerTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/OptionChainInnerChainPerRootInnerTest.java new file mode 100644 index 0000000000..304c04750f --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/OptionChainInnerChainPerRootInnerTest.java @@ -0,0 +1,68 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.OptionChainInnerChainPerRootInnerChainPerStrikePriceInner; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for OptionChainInnerChainPerRootInner + */ +public class OptionChainInnerChainPerRootInnerTest { + private final OptionChainInnerChainPerRootInner model = new OptionChainInnerChainPerRootInner(); + + /** + * Model tests for OptionChainInnerChainPerRootInner + */ + @Test + public void testOptionChainInnerChainPerRootInner() { + // TODO: test OptionChainInnerChainPerRootInner + } + + /** + * Test the property 'optionRoot' + */ + @Test + public void optionRootTest() { + // TODO: test optionRoot + } + + /** + * Test the property 'chainPerStrikePrice' + */ + @Test + public void chainPerStrikePriceTest() { + // TODO: test chainPerStrikePrice + } + + /** + * Test the property 'multiplier' + */ + @Test + public void multiplierTest() { + // TODO: test multiplier + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/OptionChainInnerTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/OptionChainInnerTest.java new file mode 100644 index 0000000000..2d9e030c45 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/OptionChainInnerTest.java @@ -0,0 +1,84 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.OptionChainInnerChainPerRootInner; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for OptionChainInner + */ +public class OptionChainInnerTest { + private final OptionChainInner model = new OptionChainInner(); + + /** + * Model tests for OptionChainInner + */ + @Test + public void testOptionChainInner() { + // TODO: test OptionChainInner + } + + /** + * Test the property 'expiryDate' + */ + @Test + public void expiryDateTest() { + // TODO: test expiryDate + } + + /** + * Test the property 'description' + */ + @Test + public void descriptionTest() { + // TODO: test description + } + + /** + * Test the property 'listingExchange' + */ + @Test + public void listingExchangeTest() { + // TODO: test listingExchange + } + + /** + * Test the property 'optionExerciseType' + */ + @Test + public void optionExerciseTypeTest() { + // TODO: test optionExerciseType + } + + /** + * Test the property 'chainPerRoot' + */ + @Test + public void chainPerRootTest() { + // TODO: test chainPerRoot + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/OptionLegTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/OptionLegTest.java new file mode 100644 index 0000000000..f7c7995a6c --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/OptionLegTest.java @@ -0,0 +1,65 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for OptionLeg + */ +public class OptionLegTest { + private final OptionLeg model = new OptionLeg(); + + /** + * Model tests for OptionLeg + */ + @Test + public void testOptionLeg() { + // TODO: test OptionLeg + } + + /** + * Test the property 'action' + */ + @Test + public void actionTest() { + // TODO: test action + } + + /** + * Test the property 'optionSymbolId' + */ + @Test + public void optionSymbolIdTest() { + // TODO: test optionSymbolId + } + + /** + * Test the property 'quantity' + */ + @Test + public void quantityTest() { + // TODO: test quantity + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/OptionStrategyLegsInnerTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/OptionStrategyLegsInnerTest.java new file mode 100644 index 0000000000..be90b38482 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/OptionStrategyLegsInnerTest.java @@ -0,0 +1,73 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for OptionStrategyLegsInner + */ +public class OptionStrategyLegsInnerTest { + private final OptionStrategyLegsInner model = new OptionStrategyLegsInner(); + + /** + * Model tests for OptionStrategyLegsInner + */ + @Test + public void testOptionStrategyLegsInner() { + // TODO: test OptionStrategyLegsInner + } + + /** + * Test the property 'optionSymbolId' + */ + @Test + public void optionSymbolIdTest() { + // TODO: test optionSymbolId + } + + /** + * Test the property 'index' + */ + @Test + public void indexTest() { + // TODO: test index + } + + /** + * Test the property 'action' + */ + @Test + public void actionTest() { + // TODO: test action + } + + /** + * Test the property 'quantity' + */ + @Test + public void quantityTest() { + // TODO: test quantity + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/OptionStrategyTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/OptionStrategyTest.java new file mode 100644 index 0000000000..81617d3963 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/OptionStrategyTest.java @@ -0,0 +1,86 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.OptionStrategyLegsInner; +import com.konfigthis.client.model.UniversalSymbol; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for OptionStrategy + */ +public class OptionStrategyTest { + private final OptionStrategy model = new OptionStrategy(); + + /** + * Model tests for OptionStrategy + */ + @Test + public void testOptionStrategy() { + // TODO: test OptionStrategy + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'underlyingSymbolId' + */ + @Test + public void underlyingSymbolIdTest() { + // TODO: test underlyingSymbolId + } + + /** + * Test the property 'strategyType' + */ + @Test + public void strategyTypeTest() { + // TODO: test strategyType + } + + /** + * Test the property 'numberOfLegs' + */ + @Test + public void numberOfLegsTest() { + // TODO: test numberOfLegs + } + + /** + * Test the property 'legs' + */ + @Test + public void legsTest() { + // TODO: test legs + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/OptionsGetOptionStrategyRequestTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/OptionsGetOptionStrategyRequestTest.java new file mode 100644 index 0000000000..e9923ab1eb --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/OptionsGetOptionStrategyRequestTest.java @@ -0,0 +1,69 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.OptionLeg; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for OptionsGetOptionStrategyRequest + */ +public class OptionsGetOptionStrategyRequestTest { + private final OptionsGetOptionStrategyRequest model = new OptionsGetOptionStrategyRequest(); + + /** + * Model tests for OptionsGetOptionStrategyRequest + */ + @Test + public void testOptionsGetOptionStrategyRequest() { + // TODO: test OptionsGetOptionStrategyRequest + } + + /** + * Test the property 'underlyingSymbolId' + */ + @Test + public void underlyingSymbolIdTest() { + // TODO: test underlyingSymbolId + } + + /** + * Test the property 'legs' + */ + @Test + public void legsTest() { + // TODO: test legs + } + + /** + * Test the property 'strategyType' + */ + @Test + public void strategyTypeTest() { + // TODO: test strategyType + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/OptionsPlaceOptionStrategyRequestTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/OptionsPlaceOptionStrategyRequestTest.java new file mode 100644 index 0000000000..807a691ae0 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/OptionsPlaceOptionStrategyRequestTest.java @@ -0,0 +1,68 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.OrderTypeStrict; +import com.konfigthis.client.model.TimeInForceStrict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for OptionsPlaceOptionStrategyRequest + */ +public class OptionsPlaceOptionStrategyRequestTest { + private final OptionsPlaceOptionStrategyRequest model = new OptionsPlaceOptionStrategyRequest(); + + /** + * Model tests for OptionsPlaceOptionStrategyRequest + */ + @Test + public void testOptionsPlaceOptionStrategyRequest() { + // TODO: test OptionsPlaceOptionStrategyRequest + } + + /** + * Test the property 'orderType' + */ + @Test + public void orderTypeTest() { + // TODO: test orderType + } + + /** + * Test the property 'timeInForce' + */ + @Test + public void timeInForceTest() { + // TODO: test timeInForce + } + + /** + * Test the property 'price' + */ + @Test + public void priceTest() { + // TODO: test price + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/OptionsPositionTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/OptionsPositionTest.java new file mode 100644 index 0000000000..9043c8cf3b --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/OptionsPositionTest.java @@ -0,0 +1,84 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.CurrencyNullable; +import com.konfigthis.client.model.OptionBrokerageSymbol; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for OptionsPosition + */ +public class OptionsPositionTest { + private final OptionsPosition model = new OptionsPosition(); + + /** + * Model tests for OptionsPosition + */ + @Test + public void testOptionsPosition() { + // TODO: test OptionsPosition + } + + /** + * Test the property 'symbol' + */ + @Test + public void symbolTest() { + // TODO: test symbol + } + + /** + * Test the property 'price' + */ + @Test + public void priceTest() { + // TODO: test price + } + + /** + * Test the property 'units' + */ + @Test + public void unitsTest() { + // TODO: test units + } + + /** + * Test the property 'currency' + */ + @Test + public void currencyTest() { + // TODO: test currency + } + + /** + * Test the property 'averagePurchasePrice' + */ + @Test + public void averagePurchasePriceTest() { + // TODO: test averagePurchasePrice + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/OptionsSymbolNullableTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/OptionsSymbolNullableTest.java new file mode 100644 index 0000000000..4ff88f1b61 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/OptionsSymbolNullableTest.java @@ -0,0 +1,115 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.UnderlyingSymbol; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for OptionsSymbolNullable + */ +public class OptionsSymbolNullableTest { + private final OptionsSymbolNullable model = new OptionsSymbolNullable(); + + /** + * Model tests for OptionsSymbolNullable + */ + @Test + public void testOptionsSymbolNullable() { + // TODO: test OptionsSymbolNullable + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'ticker' + */ + @Test + public void tickerTest() { + // TODO: test ticker + } + + /** + * Test the property 'optionType' + */ + @Test + public void optionTypeTest() { + // TODO: test optionType + } + + /** + * Test the property 'strikePrice' + */ + @Test + public void strikePriceTest() { + // TODO: test strikePrice + } + + /** + * Test the property 'expirationDate' + */ + @Test + public void expirationDateTest() { + // TODO: test expirationDate + } + + /** + * Test the property 'isMiniOption' + */ + @Test + public void isMiniOptionTest() { + // TODO: test isMiniOption + } + + /** + * Test the property 'underlyingSymbol' + */ + @Test + public void underlyingSymbolTest() { + // TODO: test underlyingSymbol + } + + /** + * Test the property 'localId' + */ + @Test + public void localIdTest() { + // TODO: test localId + } + + /** + * Test the property 'exchangeId' + */ + @Test + public void exchangeIdTest() { + // TODO: test exchangeId + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/OptionsSymbolTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/OptionsSymbolTest.java new file mode 100644 index 0000000000..c21e1d693c --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/OptionsSymbolTest.java @@ -0,0 +1,115 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.UnderlyingSymbol; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for OptionsSymbol + */ +public class OptionsSymbolTest { + private final OptionsSymbol model = new OptionsSymbol(); + + /** + * Model tests for OptionsSymbol + */ + @Test + public void testOptionsSymbol() { + // TODO: test OptionsSymbol + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'ticker' + */ + @Test + public void tickerTest() { + // TODO: test ticker + } + + /** + * Test the property 'optionType' + */ + @Test + public void optionTypeTest() { + // TODO: test optionType + } + + /** + * Test the property 'strikePrice' + */ + @Test + public void strikePriceTest() { + // TODO: test strikePrice + } + + /** + * Test the property 'expirationDate' + */ + @Test + public void expirationDateTest() { + // TODO: test expirationDate + } + + /** + * Test the property 'isMiniOption' + */ + @Test + public void isMiniOptionTest() { + // TODO: test isMiniOption + } + + /** + * Test the property 'underlyingSymbol' + */ + @Test + public void underlyingSymbolTest() { + // TODO: test underlyingSymbol + } + + /** + * Test the property 'localId' + */ + @Test + public void localIdTest() { + // TODO: test localId + } + + /** + * Test the property 'exchangeId' + */ + @Test + public void exchangeIdTest() { + // TODO: test exchangeId + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/OrderTypeStrictTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/OrderTypeStrictTest.java new file mode 100644 index 0000000000..d26b61f390 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/OrderTypeStrictTest.java @@ -0,0 +1,33 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import io.swagger.annotations.ApiModel; +import com.google.gson.annotations.SerializedName; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for OrderTypeStrict + */ +public class OrderTypeStrictTest { + /** + * Model tests for OrderTypeStrict + */ + @Test + public void testOrderTypeStrict() { + // TODO: test OrderTypeStrict + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/PartnerDataTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/PartnerDataTest.java new file mode 100644 index 0000000000..4fdd67cd2b --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/PartnerDataTest.java @@ -0,0 +1,140 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.Brokerage; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for PartnerData + */ +public class PartnerDataTest { + private final PartnerData model = new PartnerData(); + + /** + * Model tests for PartnerData + */ + @Test + public void testPartnerData() { + // TODO: test PartnerData + } + + /** + * Test the property 'redirectUri' + */ + @Test + public void redirectUriTest() { + // TODO: test redirectUri + } + + /** + * Test the property 'allowedBrokerages' + */ + @Test + public void allowedBrokeragesTest() { + // TODO: test allowedBrokerages + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'slug' + */ + @Test + public void slugTest() { + // TODO: test slug + } + + /** + * Test the property 'logoUrl' + */ + @Test + public void logoUrlTest() { + // TODO: test logoUrl + } + + /** + * Test the property 'pinRequired' + */ + @Test + public void pinRequiredTest() { + // TODO: test pinRequired + } + + /** + * Test the property 'canAccessTrades' + */ + @Test + public void canAccessTradesTest() { + // TODO: test canAccessTrades + } + + /** + * Test the property 'canAccessHoldings' + */ + @Test + public void canAccessHoldingsTest() { + // TODO: test canAccessHoldings + } + + /** + * Test the property 'canAccessAccountHistory' + */ + @Test + public void canAccessAccountHistoryTest() { + // TODO: test canAccessAccountHistory + } + + /** + * Test the property 'canAccessReferenceData' + */ + @Test + public void canAccessReferenceDataTest() { + // TODO: test canAccessReferenceData + } + + /** + * Test the property 'canAccessPortfolioManagement' + */ + @Test + public void canAccessPortfolioManagementTest() { + // TODO: test canAccessPortfolioManagement + } + + /** + * Test the property 'canAccessOrders' + */ + @Test + public void canAccessOrdersTest() { + // TODO: test canAccessOrders + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/PastValueTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/PastValueTest.java new file mode 100644 index 0000000000..4626eb78bd --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/PastValueTest.java @@ -0,0 +1,66 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.time.LocalDate; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for PastValue + */ +public class PastValueTest { + private final PastValue model = new PastValue(); + + /** + * Model tests for PastValue + */ + @Test + public void testPastValue() { + // TODO: test PastValue + } + + /** + * Test the property 'date' + */ + @Test + public void dateTest() { + // TODO: test date + } + + /** + * Test the property 'value' + */ + @Test + public void valueTest() { + // TODO: test value + } + + /** + * Test the property 'currency' + */ + @Test + public void currencyTest() { + // TODO: test currency + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/PerformanceCustomTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/PerformanceCustomTest.java new file mode 100644 index 0000000000..f049b00f81 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/PerformanceCustomTest.java @@ -0,0 +1,201 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.MonthlyDividends; +import com.konfigthis.client.model.NetContributions; +import com.konfigthis.client.model.NetDividend; +import com.konfigthis.client.model.PastValue; +import com.konfigthis.client.model.SubPeriodReturnRate; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for PerformanceCustom + */ +public class PerformanceCustomTest { + private final PerformanceCustom model = new PerformanceCustom(); + + /** + * Model tests for PerformanceCustom + */ + @Test + public void testPerformanceCustom() { + // TODO: test PerformanceCustom + } + + /** + * Test the property 'totalEquityTimeframe' + */ + @Test + public void totalEquityTimeframeTest() { + // TODO: test totalEquityTimeframe + } + + /** + * Test the property 'contributions' + */ + @Test + public void contributionsTest() { + // TODO: test contributions + } + + /** + * Test the property 'contributionTimeframe' + */ + @Test + public void contributionTimeframeTest() { + // TODO: test contributionTimeframe + } + + /** + * Test the property 'contributionTimeframeCumulative' + */ + @Test + public void contributionTimeframeCumulativeTest() { + // TODO: test contributionTimeframeCumulative + } + + /** + * Test the property 'withdrawalTimeframe' + */ + @Test + public void withdrawalTimeframeTest() { + // TODO: test withdrawalTimeframe + } + + /** + * Test the property 'contributionStreak' + */ + @Test + public void contributionStreakTest() { + // TODO: test contributionStreak + } + + /** + * Test the property 'contributionMonthsContributed' + */ + @Test + public void contributionMonthsContributedTest() { + // TODO: test contributionMonthsContributed + } + + /** + * Test the property 'contributionTotalMonths' + */ + @Test + public void contributionTotalMonthsTest() { + // TODO: test contributionTotalMonths + } + + /** + * Test the property 'dividends' + */ + @Test + public void dividendsTest() { + // TODO: test dividends + } + + /** + * Test the property 'dividendIncome' + */ + @Test + public void dividendIncomeTest() { + // TODO: test dividendIncome + } + + /** + * Test the property 'monthlyDividends' + */ + @Test + public void monthlyDividendsTest() { + // TODO: test monthlyDividends + } + + /** + * Test the property 'badTickers' + */ + @Test + public void badTickersTest() { + // TODO: test badTickers + } + + /** + * Test the property 'dividendTimeline' + */ + @Test + public void dividendTimelineTest() { + // TODO: test dividendTimeline + } + + /** + * Test the property 'commissions' + */ + @Test + public void commissionsTest() { + // TODO: test commissions + } + + /** + * Test the property 'forexFees' + */ + @Test + public void forexFeesTest() { + // TODO: test forexFees + } + + /** + * Test the property 'fees' + */ + @Test + public void feesTest() { + // TODO: test fees + } + + /** + * Test the property 'rateOfReturn' + */ + @Test + public void rateOfReturnTest() { + // TODO: test rateOfReturn + } + + /** + * Test the property 'returnRateTimeframe' + */ + @Test + public void returnRateTimeframeTest() { + // TODO: test returnRateTimeframe + } + + /** + * Test the property 'detailedMode' + */ + @Test + public void detailedModeTest() { + // TODO: test detailedMode + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/PortfolioGroupInfoTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/PortfolioGroupInfoTest.java new file mode 100644 index 0000000000..d3fc827680 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/PortfolioGroupInfoTest.java @@ -0,0 +1,139 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.Balance; +import com.konfigthis.client.model.BrokerageAuthorization; +import com.konfigthis.client.model.CalculatedTrade; +import com.konfigthis.client.model.ExcludedAsset; +import com.konfigthis.client.model.PortfolioGroupSettings; +import com.konfigthis.client.model.Position; +import com.konfigthis.client.model.TargetAsset; +import com.konfigthis.client.model.UniversalSymbol; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for PortfolioGroupInfo + */ +public class PortfolioGroupInfoTest { + private final PortfolioGroupInfo model = new PortfolioGroupInfo(); + + /** + * Model tests for PortfolioGroupInfo + */ + @Test + public void testPortfolioGroupInfo() { + // TODO: test PortfolioGroupInfo + } + + /** + * Test the property 'symbols' + */ + @Test + public void symbolsTest() { + // TODO: test symbols + } + + /** + * Test the property 'quotableSymbols' + */ + @Test + public void quotableSymbolsTest() { + // TODO: test quotableSymbols + } + + /** + * Test the property 'balances' + */ + @Test + public void balancesTest() { + // TODO: test balances + } + + /** + * Test the property 'positions' + */ + @Test + public void positionsTest() { + // TODO: test positions + } + + /** + * Test the property 'targetPositions' + */ + @Test + public void targetPositionsTest() { + // TODO: test targetPositions + } + + /** + * Test the property 'idealPositions' + */ + @Test + public void idealPositionsTest() { + // TODO: test idealPositions + } + + /** + * Test the property 'excludedPositions' + */ + @Test + public void excludedPositionsTest() { + // TODO: test excludedPositions + } + + /** + * Test the property 'calculatedTrades' + */ + @Test + public void calculatedTradesTest() { + // TODO: test calculatedTrades + } + + /** + * Test the property 'brokerageAuthorizations' + */ + @Test + public void brokerageAuthorizationsTest() { + // TODO: test brokerageAuthorizations + } + + /** + * Test the property 'accuracy' + */ + @Test + public void accuracyTest() { + // TODO: test accuracy + } + + /** + * Test the property 'settings' + */ + @Test + public void settingsTest() { + // TODO: test settings + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/PortfolioGroupPositionTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/PortfolioGroupPositionTest.java new file mode 100644 index 0000000000..afbf4a3463 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/PortfolioGroupPositionTest.java @@ -0,0 +1,67 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.UniversalSymbol; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for PortfolioGroupPosition + */ +public class PortfolioGroupPositionTest { + private final PortfolioGroupPosition model = new PortfolioGroupPosition(); + + /** + * Model tests for PortfolioGroupPosition + */ + @Test + public void testPortfolioGroupPosition() { + // TODO: test PortfolioGroupPosition + } + + /** + * Test the property 'symbol' + */ + @Test + public void symbolTest() { + // TODO: test symbol + } + + /** + * Test the property 'price' + */ + @Test + public void priceTest() { + // TODO: test price + } + + /** + * Test the property 'units' + */ + @Test + public void unitsTest() { + // TODO: test units + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/PortfolioGroupSettingsTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/PortfolioGroupSettingsTest.java new file mode 100644 index 0000000000..1d2a999fb7 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/PortfolioGroupSettingsTest.java @@ -0,0 +1,82 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.Currency; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for PortfolioGroupSettings + */ +public class PortfolioGroupSettingsTest { + private final PortfolioGroupSettings model = new PortfolioGroupSettings(); + + /** + * Model tests for PortfolioGroupSettings + */ + @Test + public void testPortfolioGroupSettings() { + // TODO: test PortfolioGroupSettings + } + + /** + * Test the property 'buyOnly' + */ + @Test + public void buyOnlyTest() { + // TODO: test buyOnly + } + + /** + * Test the property 'cashOptimizer' + */ + @Test + public void cashOptimizerTest() { + // TODO: test cashOptimizer + } + + /** + * Test the property 'notifyFrequency' + */ + @Test + public void notifyFrequencyTest() { + // TODO: test notifyFrequency + } + + /** + * Test the property 'driftThreshold' + */ + @Test + public void driftThresholdTest() { + // TODO: test driftThreshold + } + + /** + * Test the property 'preferredCurrency' + */ + @Test + public void preferredCurrencyTest() { + // TODO: test preferredCurrency + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/PortfolioGroupTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/PortfolioGroupTest.java new file mode 100644 index 0000000000..8dfedc7fed --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/PortfolioGroupTest.java @@ -0,0 +1,58 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for PortfolioGroup + */ +public class PortfolioGroupTest { + private final PortfolioGroup model = new PortfolioGroup(); + + /** + * Model tests for PortfolioGroup + */ + @Test + public void testPortfolioGroup() { + // TODO: test PortfolioGroup + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/PositionSymbolTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/PositionSymbolTest.java new file mode 100644 index 0000000000..3c5246ef8e --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/PositionSymbolTest.java @@ -0,0 +1,92 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.UniversalSymbol; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for PositionSymbol + */ +public class PositionSymbolTest { + private final PositionSymbol model = new PositionSymbol(); + + /** + * Model tests for PositionSymbol + */ + @Test + public void testPositionSymbol() { + // TODO: test PositionSymbol + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'description' + */ + @Test + public void descriptionTest() { + // TODO: test description + } + + /** + * Test the property 'symbol' + */ + @Test + public void symbolTest() { + // TODO: test symbol + } + + /** + * Test the property 'localId' + */ + @Test + public void localIdTest() { + // TODO: test localId + } + + /** + * Test the property 'isQuotable' + */ + @Test + public void isQuotableTest() { + // TODO: test isQuotable + } + + /** + * Test the property 'isTradable' + */ + @Test + public void isTradableTest() { + // TODO: test isTradable + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/PositionTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/PositionTest.java new file mode 100644 index 0000000000..555f2c5b56 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/PositionTest.java @@ -0,0 +1,91 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.PositionSymbol; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for Position + */ +public class PositionTest { + private final Position model = new Position(); + + /** + * Model tests for Position + */ + @Test + public void testPosition() { + // TODO: test Position + } + + /** + * Test the property 'symbol' + */ + @Test + public void symbolTest() { + // TODO: test symbol + } + + /** + * Test the property 'units' + */ + @Test + public void unitsTest() { + // TODO: test units + } + + /** + * Test the property 'price' + */ + @Test + public void priceTest() { + // TODO: test price + } + + /** + * Test the property 'openPnl' + */ + @Test + public void openPnlTest() { + // TODO: test openPnl + } + + /** + * Test the property 'fractionalUnits' + */ + @Test + public void fractionalUnitsTest() { + // TODO: test fractionalUnits + } + + /** + * Test the property 'averagePurchasePrice' + */ + @Test + public void averagePurchasePriceTest() { + // TODO: test averagePurchasePrice + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/RedirectTokenandPinTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/RedirectTokenandPinTest.java new file mode 100644 index 0000000000..f704eeb10c --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/RedirectTokenandPinTest.java @@ -0,0 +1,57 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for RedirectTokenandPin + */ +public class RedirectTokenandPinTest { + private final RedirectTokenandPin model = new RedirectTokenandPin(); + + /** + * Model tests for RedirectTokenandPin + */ + @Test + public void testRedirectTokenandPin() { + // TODO: test RedirectTokenandPin + } + + /** + * Test the property 'token' + */ + @Test + public void tokenTest() { + // TODO: test token + } + + /** + * Test the property 'pin' + */ + @Test + public void pinTest() { + // TODO: test pin + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/SecurityTypeTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/SecurityTypeTest.java new file mode 100644 index 0000000000..7bc6372a56 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/SecurityTypeTest.java @@ -0,0 +1,74 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for SecurityType + */ +public class SecurityTypeTest { + private final SecurityType model = new SecurityType(); + + /** + * Model tests for SecurityType + */ + @Test + public void testSecurityType() { + // TODO: test SecurityType + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'code' + */ + @Test + public void codeTest() { + // TODO: test code + } + + /** + * Test the property 'description' + */ + @Test + public void descriptionTest() { + // TODO: test description + } + + /** + * Test the property 'isSupported' + */ + @Test + public void isSupportedTest() { + // TODO: test isSupported + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/SessionEventTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/SessionEventTest.java new file mode 100644 index 0000000000..581c91223d --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/SessionEventTest.java @@ -0,0 +1,99 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for SessionEvent + */ +public class SessionEventTest { + private final SessionEvent model = new SessionEvent(); + + /** + * Model tests for SessionEvent + */ + @Test + public void testSessionEvent() { + // TODO: test SessionEvent + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'sessionEventType' + */ + @Test + public void sessionEventTypeTest() { + // TODO: test sessionEventType + } + + /** + * Test the property 'sessionId' + */ + @Test + public void sessionIdTest() { + // TODO: test sessionId + } + + /** + * Test the property 'userId' + */ + @Test + public void userIdTest() { + // TODO: test userId + } + + /** + * Test the property 'createdDate' + */ + @Test + public void createdDateTest() { + // TODO: test createdDate + } + + /** + * Test the property 'brokerageStatusCode' + */ + @Test + public void brokerageStatusCodeTest() { + // TODO: test brokerageStatusCode + } + + /** + * Test the property 'brokerageAuthorizationId' + */ + @Test + public void brokerageAuthorizationIdTest() { + // TODO: test brokerageAuthorizationId + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/SnapTradeAPIDisclaimerAcceptStatusTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/SnapTradeAPIDisclaimerAcceptStatusTest.java new file mode 100644 index 0000000000..88214a58e1 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/SnapTradeAPIDisclaimerAcceptStatusTest.java @@ -0,0 +1,57 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for SnapTradeAPIDisclaimerAcceptStatus + */ +public class SnapTradeAPIDisclaimerAcceptStatusTest { + private final SnapTradeAPIDisclaimerAcceptStatus model = new SnapTradeAPIDisclaimerAcceptStatus(); + + /** + * Model tests for SnapTradeAPIDisclaimerAcceptStatus + */ + @Test + public void testSnapTradeAPIDisclaimerAcceptStatus() { + // TODO: test SnapTradeAPIDisclaimerAcceptStatus + } + + /** + * Test the property 'accepted' + */ + @Test + public void acceptedTest() { + // TODO: test accepted + } + + /** + * Test the property 'timestamp' + */ + @Test + public void timestampTest() { + // TODO: test timestamp + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/SnapTradeHoldingsAccountAccountIdTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/SnapTradeHoldingsAccountAccountIdTest.java new file mode 100644 index 0000000000..5643f20c9b --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/SnapTradeHoldingsAccountAccountIdTest.java @@ -0,0 +1,130 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.AccountBalanceNullable; +import com.konfigthis.client.model.CashRestriction; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for SnapTradeHoldingsAccountAccountId + */ +public class SnapTradeHoldingsAccountAccountIdTest { + private final SnapTradeHoldingsAccountAccountId model = new SnapTradeHoldingsAccountAccountId(); + + /** + * Model tests for SnapTradeHoldingsAccountAccountId + */ + @Test + public void testSnapTradeHoldingsAccountAccountId() { + // TODO: test SnapTradeHoldingsAccountAccountId + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'brokerageAuthorization' + */ + @Test + public void brokerageAuthorizationTest() { + // TODO: test brokerageAuthorization + } + + /** + * Test the property 'portfolioGroup' + */ + @Test + public void portfolioGroupTest() { + // TODO: test portfolioGroup + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'number' + */ + @Test + public void numberTest() { + // TODO: test number + } + + /** + * Test the property 'institutionName' + */ + @Test + public void institutionNameTest() { + // TODO: test institutionName + } + + /** + * Test the property 'balance' + */ + @Test + public void balanceTest() { + // TODO: test balance + } + + /** + * Test the property 'meta' + */ + @Test + public void metaTest() { + // TODO: test meta + } + + /** + * Test the property 'cashRestrictions' + */ + @Test + public void cashRestrictionsTest() { + // TODO: test cashRestrictions + } + + /** + * Test the property 'createdDate' + */ + @Test + public void createdDateTest() { + // TODO: test createdDate + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/SnapTradeHoldingsAccountTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/SnapTradeHoldingsAccountTest.java new file mode 100644 index 0000000000..117868f79d --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/SnapTradeHoldingsAccountTest.java @@ -0,0 +1,111 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.AccountSyncStatus; +import com.konfigthis.client.model.BrokerageAuthorization; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for SnapTradeHoldingsAccount + */ +public class SnapTradeHoldingsAccountTest { + private final SnapTradeHoldingsAccount model = new SnapTradeHoldingsAccount(); + + /** + * Model tests for SnapTradeHoldingsAccount + */ + @Test + public void testSnapTradeHoldingsAccount() { + // TODO: test SnapTradeHoldingsAccount + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'brokerageAuthorization' + */ + @Test + public void brokerageAuthorizationTest() { + // TODO: test brokerageAuthorization + } + + /** + * Test the property 'portfolioGroup' + */ + @Test + public void portfolioGroupTest() { + // TODO: test portfolioGroup + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'number' + */ + @Test + public void numberTest() { + // TODO: test number + } + + /** + * Test the property 'institutionName' + */ + @Test + public void institutionNameTest() { + // TODO: test institutionName + } + + /** + * Test the property 'syncStatus' + */ + @Test + public void syncStatusTest() { + // TODO: test syncStatus + } + + /** + * Test the property 'meta' + */ + @Test + public void metaTest() { + // TODO: test meta + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/SnapTradeHoldingsTotalValueTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/SnapTradeHoldingsTotalValueTest.java new file mode 100644 index 0000000000..dbdb452b34 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/SnapTradeHoldingsTotalValueTest.java @@ -0,0 +1,58 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for SnapTradeHoldingsTotalValue + */ +public class SnapTradeHoldingsTotalValueTest { + private final SnapTradeHoldingsTotalValue model = new SnapTradeHoldingsTotalValue(); + + /** + * Model tests for SnapTradeHoldingsTotalValue + */ + @Test + public void testSnapTradeHoldingsTotalValue() { + // TODO: test SnapTradeHoldingsTotalValue + } + + /** + * Test the property 'value' + */ + @Test + public void valueTest() { + // TODO: test value + } + + /** + * Test the property 'currency' + */ + @Test + public void currencyTest() { + // TODO: test currency + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/SnapTradeLoginUserRequestBodyTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/SnapTradeLoginUserRequestBodyTest.java new file mode 100644 index 0000000000..ad4a48090f --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/SnapTradeLoginUserRequestBodyTest.java @@ -0,0 +1,89 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for SnapTradeLoginUserRequestBody + */ +public class SnapTradeLoginUserRequestBodyTest { + private final SnapTradeLoginUserRequestBody model = new SnapTradeLoginUserRequestBody(); + + /** + * Model tests for SnapTradeLoginUserRequestBody + */ + @Test + public void testSnapTradeLoginUserRequestBody() { + // TODO: test SnapTradeLoginUserRequestBody + } + + /** + * Test the property 'broker' + */ + @Test + public void brokerTest() { + // TODO: test broker + } + + /** + * Test the property 'immediateRedirect' + */ + @Test + public void immediateRedirectTest() { + // TODO: test immediateRedirect + } + + /** + * Test the property 'customRedirect' + */ + @Test + public void customRedirectTest() { + // TODO: test customRedirect + } + + /** + * Test the property 'reconnect' + */ + @Test + public void reconnectTest() { + // TODO: test reconnect + } + + /** + * Test the property 'connectionType' + */ + @Test + public void connectionTypeTest() { + // TODO: test connectionType + } + + /** + * Test the property 'connectionPortalVersion' + */ + @Test + public void connectionPortalVersionTest() { + // TODO: test connectionPortalVersion + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/SnapTradeRegisterUserRequestBodyTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/SnapTradeRegisterUserRequestBodyTest.java new file mode 100644 index 0000000000..c3d0121de5 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/SnapTradeRegisterUserRequestBodyTest.java @@ -0,0 +1,49 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for SnapTradeRegisterUserRequestBody + */ +public class SnapTradeRegisterUserRequestBodyTest { + private final SnapTradeRegisterUserRequestBody model = new SnapTradeRegisterUserRequestBody(); + + /** + * Model tests for SnapTradeRegisterUserRequestBody + */ + @Test + public void testSnapTradeRegisterUserRequestBody() { + // TODO: test SnapTradeRegisterUserRequestBody + } + + /** + * Test the property 'userId' + */ + @Test + public void userIdTest() { + // TODO: test userId + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/StatusTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/StatusTest.java new file mode 100644 index 0000000000..73df76ed2c --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/StatusTest.java @@ -0,0 +1,65 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for Status + */ +public class StatusTest { + private final Status model = new Status(); + + /** + * Model tests for Status + */ + @Test + public void testStatus() { + // TODO: test Status + } + + /** + * Test the property 'version' + */ + @Test + public void versionTest() { + // TODO: test version + } + + /** + * Test the property 'timestamp' + */ + @Test + public void timestampTest() { + // TODO: test timestamp + } + + /** + * Test the property 'online' + */ + @Test + public void onlineTest() { + // TODO: test online + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/StrategyImpactLegsInnerTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/StrategyImpactLegsInnerTest.java new file mode 100644 index 0000000000..5559741098 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/StrategyImpactLegsInnerTest.java @@ -0,0 +1,97 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for StrategyImpactLegsInner + */ +public class StrategyImpactLegsInnerTest { + private final StrategyImpactLegsInner model = new StrategyImpactLegsInner(); + + /** + * Model tests for StrategyImpactLegsInner + */ + @Test + public void testStrategyImpactLegsInner() { + // TODO: test StrategyImpactLegsInner + } + + /** + * Test the property 'legId' + */ + @Test + public void legIdTest() { + // TODO: test legId + } + + /** + * Test the property 'symbol' + */ + @Test + public void symbolTest() { + // TODO: test symbol + } + + /** + * Test the property 'symbolId' + */ + @Test + public void symbolIdTest() { + // TODO: test symbolId + } + + /** + * Test the property 'legRatioQuantity' + */ + @Test + public void legRatioQuantityTest() { + // TODO: test legRatioQuantity + } + + /** + * Test the property 'side' + */ + @Test + public void sideTest() { + // TODO: test side + } + + /** + * Test the property 'avgExecPrice' + */ + @Test + public void avgExecPriceTest() { + // TODO: test avgExecPrice + } + + /** + * Test the property 'lastExecPrice' + */ + @Test + public void lastExecPriceTest() { + // TODO: test lastExecPrice + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/StrategyImpactTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/StrategyImpactTest.java new file mode 100644 index 0000000000..9a6168d262 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/StrategyImpactTest.java @@ -0,0 +1,132 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.StrategyImpactLegsInner; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for StrategyImpact + */ +public class StrategyImpactTest { + private final StrategyImpact model = new StrategyImpact(); + + /** + * Model tests for StrategyImpact + */ + @Test + public void testStrategyImpact() { + // TODO: test StrategyImpact + } + + /** + * Test the property 'estimatedCommissions' + */ + @Test + public void estimatedCommissionsTest() { + // TODO: test estimatedCommissions + } + + /** + * Test the property 'buyingPowerEffect' + */ + @Test + public void buyingPowerEffectTest() { + // TODO: test buyingPowerEffect + } + + /** + * Test the property 'buyingPowerResult' + */ + @Test + public void buyingPowerResultTest() { + // TODO: test buyingPowerResult + } + + /** + * Test the property 'maintExcessEffect' + */ + @Test + public void maintExcessEffectTest() { + // TODO: test maintExcessEffect + } + + /** + * Test the property 'maintExcessResult' + */ + @Test + public void maintExcessResultTest() { + // TODO: test maintExcessResult + } + + /** + * Test the property 'tradeValueCalculation' + */ + @Test + public void tradeValueCalculationTest() { + // TODO: test tradeValueCalculation + } + + /** + * Test the property 'legs' + */ + @Test + public void legsTest() { + // TODO: test legs + } + + /** + * Test the property 'side' + */ + @Test + public void sideTest() { + // TODO: test side + } + + /** + * Test the property 'effect' + */ + @Test + public void effectTest() { + // TODO: test effect + } + + /** + * Test the property 'price' + */ + @Test + public void priceTest() { + // TODO: test price + } + + /** + * Test the property 'strategy' + */ + @Test + public void strategyTest() { + // TODO: test strategy + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/StrategyOrderPlaceOrdersInnerLegsInnerTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/StrategyOrderPlaceOrdersInnerLegsInnerTest.java new file mode 100644 index 0000000000..fda5949533 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/StrategyOrderPlaceOrdersInnerLegsInnerTest.java @@ -0,0 +1,97 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for StrategyOrderPlaceOrdersInnerLegsInner + */ +public class StrategyOrderPlaceOrdersInnerLegsInnerTest { + private final StrategyOrderPlaceOrdersInnerLegsInner model = new StrategyOrderPlaceOrdersInnerLegsInner(); + + /** + * Model tests for StrategyOrderPlaceOrdersInnerLegsInner + */ + @Test + public void testStrategyOrderPlaceOrdersInnerLegsInner() { + // TODO: test StrategyOrderPlaceOrdersInnerLegsInner + } + + /** + * Test the property 'legId' + */ + @Test + public void legIdTest() { + // TODO: test legId + } + + /** + * Test the property 'symbol' + */ + @Test + public void symbolTest() { + // TODO: test symbol + } + + /** + * Test the property 'symbolId' + */ + @Test + public void symbolIdTest() { + // TODO: test symbolId + } + + /** + * Test the property 'legRatioQuantity' + */ + @Test + public void legRatioQuantityTest() { + // TODO: test legRatioQuantity + } + + /** + * Test the property 'side' + */ + @Test + public void sideTest() { + // TODO: test side + } + + /** + * Test the property 'avgExecPrice' + */ + @Test + public void avgExecPriceTest() { + // TODO: test avgExecPrice + } + + /** + * Test the property 'lastExecPrice' + */ + @Test + public void lastExecPriceTest() { + // TODO: test lastExecPrice + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/StrategyOrderPlaceOrdersInnerTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/StrategyOrderPlaceOrdersInnerTest.java new file mode 100644 index 0000000000..654f2d66e7 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/StrategyOrderPlaceOrdersInnerTest.java @@ -0,0 +1,388 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.StrategyOrderPlaceOrdersInnerLegsInner; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for StrategyOrderPlaceOrdersInner + */ +public class StrategyOrderPlaceOrdersInnerTest { + private final StrategyOrderPlaceOrdersInner model = new StrategyOrderPlaceOrdersInner(); + + /** + * Model tests for StrategyOrderPlaceOrdersInner + */ + @Test + public void testStrategyOrderPlaceOrdersInner() { + // TODO: test StrategyOrderPlaceOrdersInner + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'symbol' + */ + @Test + public void symbolTest() { + // TODO: test symbol + } + + /** + * Test the property 'symbolId' + */ + @Test + public void symbolIdTest() { + // TODO: test symbolId + } + + /** + * Test the property 'totalQuantity' + */ + @Test + public void totalQuantityTest() { + // TODO: test totalQuantity + } + + /** + * Test the property 'openQuantity' + */ + @Test + public void openQuantityTest() { + // TODO: test openQuantity + } + + /** + * Test the property 'filledQuantity' + */ + @Test + public void filledQuantityTest() { + // TODO: test filledQuantity + } + + /** + * Test the property 'canceledQuantity' + */ + @Test + public void canceledQuantityTest() { + // TODO: test canceledQuantity + } + + /** + * Test the property 'side' + */ + @Test + public void sideTest() { + // TODO: test side + } + + /** + * Test the property 'orderType' + */ + @Test + public void orderTypeTest() { + // TODO: test orderType + } + + /** + * Test the property 'limitPrice' + */ + @Test + public void limitPriceTest() { + // TODO: test limitPrice + } + + /** + * Test the property 'stopPrice' + */ + @Test + public void stopPriceTest() { + // TODO: test stopPrice + } + + /** + * Test the property 'isAllOrNone' + */ + @Test + public void isAllOrNoneTest() { + // TODO: test isAllOrNone + } + + /** + * Test the property 'isAnonymous' + */ + @Test + public void isAnonymousTest() { + // TODO: test isAnonymous + } + + /** + * Test the property 'icebergQuantity' + */ + @Test + public void icebergQuantityTest() { + // TODO: test icebergQuantity + } + + /** + * Test the property 'minQuantity' + */ + @Test + public void minQuantityTest() { + // TODO: test minQuantity + } + + /** + * Test the property 'avgExecPrice' + */ + @Test + public void avgExecPriceTest() { + // TODO: test avgExecPrice + } + + /** + * Test the property 'lastExecPrice' + */ + @Test + public void lastExecPriceTest() { + // TODO: test lastExecPrice + } + + /** + * Test the property 'source' + */ + @Test + public void sourceTest() { + // TODO: test source + } + + /** + * Test the property 'timeInForce' + */ + @Test + public void timeInForceTest() { + // TODO: test timeInForce + } + + /** + * Test the property 'gtdDate' + */ + @Test + public void gtdDateTest() { + // TODO: test gtdDate + } + + /** + * Test the property 'state' + */ + @Test + public void stateTest() { + // TODO: test state + } + + /** + * Test the property 'rejectionReason' + */ + @Test + public void rejectionReasonTest() { + // TODO: test rejectionReason + } + + /** + * Test the property 'chainId' + */ + @Test + public void chainIdTest() { + // TODO: test chainId + } + + /** + * Test the property 'creationTime' + */ + @Test + public void creationTimeTest() { + // TODO: test creationTime + } + + /** + * Test the property 'updateTime' + */ + @Test + public void updateTimeTest() { + // TODO: test updateTime + } + + /** + * Test the property 'notes' + */ + @Test + public void notesTest() { + // TODO: test notes + } + + /** + * Test the property 'primaryRoute' + */ + @Test + public void primaryRouteTest() { + // TODO: test primaryRoute + } + + /** + * Test the property 'secondaryRoute' + */ + @Test + public void secondaryRouteTest() { + // TODO: test secondaryRoute + } + + /** + * Test the property 'orderRoute' + */ + @Test + public void orderRouteTest() { + // TODO: test orderRoute + } + + /** + * Test the property 'venueHoldingOrder' + */ + @Test + public void venueHoldingOrderTest() { + // TODO: test venueHoldingOrder + } + + /** + * Test the property 'comissionCharged' + */ + @Test + public void comissionChargedTest() { + // TODO: test comissionCharged + } + + /** + * Test the property 'exchangeOrderId' + */ + @Test + public void exchangeOrderIdTest() { + // TODO: test exchangeOrderId + } + + /** + * Test the property 'isSignificantShareHolder' + */ + @Test + public void isSignificantShareHolderTest() { + // TODO: test isSignificantShareHolder + } + + /** + * Test the property 'isInsider' + */ + @Test + public void isInsiderTest() { + // TODO: test isInsider + } + + /** + * Test the property 'isLimitOffsetInDollar' + */ + @Test + public void isLimitOffsetInDollarTest() { + // TODO: test isLimitOffsetInDollar + } + + /** + * Test the property 'userId' + */ + @Test + public void userIdTest() { + // TODO: test userId + } + + /** + * Test the property 'placementCommission' + */ + @Test + public void placementCommissionTest() { + // TODO: test placementCommission + } + + /** + * Test the property 'legs' + */ + @Test + public void legsTest() { + // TODO: test legs + } + + /** + * Test the property 'strategyType' + */ + @Test + public void strategyTypeTest() { + // TODO: test strategyType + } + + /** + * Test the property 'triggerStopPrice' + */ + @Test + public void triggerStopPriceTest() { + // TODO: test triggerStopPrice + } + + /** + * Test the property 'orderGroupId' + */ + @Test + public void orderGroupIdTest() { + // TODO: test orderGroupId + } + + /** + * Test the property 'orderClass' + */ + @Test + public void orderClassTest() { + // TODO: test orderClass + } + + /** + * Test the property 'isCrossZero' + */ + @Test + public void isCrossZeroTest() { + // TODO: test isCrossZero + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/StrategyOrderPlaceTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/StrategyOrderPlaceTest.java new file mode 100644 index 0000000000..5b3dbdaa79 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/StrategyOrderPlaceTest.java @@ -0,0 +1,60 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.StrategyOrderPlaceOrdersInner; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for StrategyOrderPlace + */ +public class StrategyOrderPlaceTest { + private final StrategyOrderPlace model = new StrategyOrderPlace(); + + /** + * Model tests for StrategyOrderPlace + */ + @Test + public void testStrategyOrderPlace() { + // TODO: test StrategyOrderPlace + } + + /** + * Test the property 'orderId' + */ + @Test + public void orderIdTest() { + // TODO: test orderId + } + + /** + * Test the property 'orders' + */ + @Test + public void ordersTest() { + // TODO: test orders + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/StrategyOrderRecordTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/StrategyOrderRecordTest.java new file mode 100644 index 0000000000..f3508c0616 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/StrategyOrderRecordTest.java @@ -0,0 +1,131 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.OptionStrategy; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for StrategyOrderRecord + */ +public class StrategyOrderRecordTest { + private final StrategyOrderRecord model = new StrategyOrderRecord(); + + /** + * Model tests for StrategyOrderRecord + */ + @Test + public void testStrategyOrderRecord() { + // TODO: test StrategyOrderRecord + } + + /** + * Test the property 'strategy' + */ + @Test + public void strategyTest() { + // TODO: test strategy + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'filledQuantity' + */ + @Test + public void filledQuantityTest() { + // TODO: test filledQuantity + } + + /** + * Test the property 'openQuantity' + */ + @Test + public void openQuantityTest() { + // TODO: test openQuantity + } + + /** + * Test the property 'closedQuantity' + */ + @Test + public void closedQuantityTest() { + // TODO: test closedQuantity + } + + /** + * Test the property 'orderType' + */ + @Test + public void orderTypeTest() { + // TODO: test orderType + } + + /** + * Test the property 'timeInForce' + */ + @Test + public void timeInForceTest() { + // TODO: test timeInForce + } + + /** + * Test the property 'limitPrice' + */ + @Test + public void limitPriceTest() { + // TODO: test limitPrice + } + + /** + * Test the property 'executionPrice' + */ + @Test + public void executionPriceTest() { + // TODO: test executionPrice + } + + /** + * Test the property 'timePlaced' + */ + @Test + public void timePlacedTest() { + // TODO: test timePlaced + } + + /** + * Test the property 'timeUpdated' + */ + @Test + public void timeUpdatedTest() { + // TODO: test timeUpdated + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/StrategyQuotesGreekTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/StrategyQuotesGreekTest.java new file mode 100644 index 0000000000..7a47f2705f --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/StrategyQuotesGreekTest.java @@ -0,0 +1,81 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for StrategyQuotesGreek + */ +public class StrategyQuotesGreekTest { + private final StrategyQuotesGreek model = new StrategyQuotesGreek(); + + /** + * Model tests for StrategyQuotesGreek + */ + @Test + public void testStrategyQuotesGreek() { + // TODO: test StrategyQuotesGreek + } + + /** + * Test the property 'delta' + */ + @Test + public void deltaTest() { + // TODO: test delta + } + + /** + * Test the property 'gamma' + */ + @Test + public void gammaTest() { + // TODO: test gamma + } + + /** + * Test the property 'theta' + */ + @Test + public void thetaTest() { + // TODO: test theta + } + + /** + * Test the property 'vega' + */ + @Test + public void vegaTest() { + // TODO: test vega + } + + /** + * Test the property 'rho' + */ + @Test + public void rhoTest() { + // TODO: test rho + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/StrategyQuotesTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/StrategyQuotesTest.java new file mode 100644 index 0000000000..044ac9771f --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/StrategyQuotesTest.java @@ -0,0 +1,92 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.OptionStrategy; +import com.konfigthis.client.model.StrategyQuotesGreek; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for StrategyQuotes + */ +public class StrategyQuotesTest { + private final StrategyQuotes model = new StrategyQuotes(); + + /** + * Model tests for StrategyQuotes + */ + @Test + public void testStrategyQuotes() { + // TODO: test StrategyQuotes + } + + /** + * Test the property 'strategy' + */ + @Test + public void strategyTest() { + // TODO: test strategy + } + + /** + * Test the property 'openPrice' + */ + @Test + public void openPriceTest() { + // TODO: test openPrice + } + + /** + * Test the property 'bidPrice' + */ + @Test + public void bidPriceTest() { + // TODO: test bidPrice + } + + /** + * Test the property 'askPrice' + */ + @Test + public void askPriceTest() { + // TODO: test askPrice + } + + /** + * Test the property 'volatility' + */ + @Test + public void volatilityTest() { + // TODO: test volatility + } + + /** + * Test the property 'greek' + */ + @Test + public void greekTest() { + // TODO: test greek + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/SubPeriodReturnRateTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/SubPeriodReturnRateTest.java new file mode 100644 index 0000000000..13849f1aa7 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/SubPeriodReturnRateTest.java @@ -0,0 +1,67 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.time.LocalDate; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for SubPeriodReturnRate + */ +public class SubPeriodReturnRateTest { + private final SubPeriodReturnRate model = new SubPeriodReturnRate(); + + /** + * Model tests for SubPeriodReturnRate + */ + @Test + public void testSubPeriodReturnRate() { + // TODO: test SubPeriodReturnRate + } + + /** + * Test the property 'periodStart' + */ + @Test + public void periodStartTest() { + // TODO: test periodStart + } + + /** + * Test the property 'periodEnd' + */ + @Test + public void periodEndTest() { + // TODO: test periodEnd + } + + /** + * Test the property 'rateOfReturn' + */ + @Test + public void rateOfReturnTest() { + // TODO: test rateOfReturn + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/SymbolQueryTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/SymbolQueryTest.java new file mode 100644 index 0000000000..89acb9a587 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/SymbolQueryTest.java @@ -0,0 +1,49 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for SymbolQuery + */ +public class SymbolQueryTest { + private final SymbolQuery model = new SymbolQuery(); + + /** + * Model tests for SymbolQuery + */ + @Test + public void testSymbolQuery() { + // TODO: test SymbolQuery + } + + /** + * Test the property 'substring' + */ + @Test + public void substringTest() { + // TODO: test substring + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/SymbolTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/SymbolTest.java new file mode 100644 index 0000000000..e62b3f490a --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/SymbolTest.java @@ -0,0 +1,119 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.Currency; +import com.konfigthis.client.model.Exchange; +import com.konfigthis.client.model.FigiInstrumentNullable; +import com.konfigthis.client.model.SecurityType; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for Symbol + */ +public class SymbolTest { + private final Symbol model = new Symbol(); + + /** + * Model tests for Symbol + */ + @Test + public void testSymbol() { + // TODO: test Symbol + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'symbol' + */ + @Test + public void symbolTest() { + // TODO: test symbol + } + + /** + * Test the property 'rawSymbol' + */ + @Test + public void rawSymbolTest() { + // TODO: test rawSymbol + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'currency' + */ + @Test + public void currencyTest() { + // TODO: test currency + } + + /** + * Test the property 'exchange' + */ + @Test + public void exchangeTest() { + // TODO: test exchange + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'figiCode' + */ + @Test + public void figiCodeTest() { + // TODO: test figiCode + } + + /** + * Test the property 'figiInstrument' + */ + @Test + public void figiInstrumentTest() { + // TODO: test figiInstrument + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/SymbolsQuotesInnerTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/SymbolsQuotesInnerTest.java new file mode 100644 index 0000000000..da670a56cb --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/SymbolsQuotesInnerTest.java @@ -0,0 +1,90 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.UniversalSymbol; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for SymbolsQuotesInner + */ +public class SymbolsQuotesInnerTest { + private final SymbolsQuotesInner model = new SymbolsQuotesInner(); + + /** + * Model tests for SymbolsQuotesInner + */ + @Test + public void testSymbolsQuotesInner() { + // TODO: test SymbolsQuotesInner + } + + /** + * Test the property 'symbol' + */ + @Test + public void symbolTest() { + // TODO: test symbol + } + + /** + * Test the property 'bidPrice' + */ + @Test + public void bidPriceTest() { + // TODO: test bidPrice + } + + /** + * Test the property 'askPrice' + */ + @Test + public void askPriceTest() { + // TODO: test askPrice + } + + /** + * Test the property 'lastTradePrice' + */ + @Test + public void lastTradePriceTest() { + // TODO: test lastTradePrice + } + + /** + * Test the property 'bidSize' + */ + @Test + public void bidSizeTest() { + // TODO: test bidSize + } + + /** + * Test the property 'askSize' + */ + @Test + public void askSizeTest() { + // TODO: test askSize + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/TargetAssetTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/TargetAssetTest.java new file mode 100644 index 0000000000..7690f1fba3 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/TargetAssetTest.java @@ -0,0 +1,94 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.UniversalSymbol; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for TargetAsset + */ +public class TargetAssetTest { + private final TargetAsset model = new TargetAsset(); + + /** + * Model tests for TargetAsset + */ + @Test + public void testTargetAsset() { + // TODO: test TargetAsset + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'symbol' + */ + @Test + public void symbolTest() { + // TODO: test symbol + } + + /** + * Test the property 'percent' + */ + @Test + public void percentTest() { + // TODO: test percent + } + + /** + * Test the property 'isSupported' + */ + @Test + public void isSupportedTest() { + // TODO: test isSupported + } + + /** + * Test the property 'isExcluded' + */ + @Test + public void isExcludedTest() { + // TODO: test isExcluded + } + + /** + * Test the property 'meta' + */ + @Test + public void metaTest() { + // TODO: test meta + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/TimeInForceStrictTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/TimeInForceStrictTest.java new file mode 100644 index 0000000000..ffb23ce1af --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/TimeInForceStrictTest.java @@ -0,0 +1,33 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import io.swagger.annotations.ApiModel; +import com.google.gson.annotations.SerializedName; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for TimeInForceStrict + */ +public class TimeInForceStrictTest { + /** + * Model tests for TimeInForceStrict + */ + @Test + public void testTimeInForceStrict() { + // TODO: test TimeInForceStrict + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/TradeExecutionStatusTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/TradeExecutionStatusTest.java new file mode 100644 index 0000000000..acddbc02d5 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/TradeExecutionStatusTest.java @@ -0,0 +1,118 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.BrokerageSymbol; +import com.konfigthis.client.model.Trade; +import com.konfigthis.client.model.UniversalSymbol; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for TradeExecutionStatus + */ +public class TradeExecutionStatusTest { + private final TradeExecutionStatus model = new TradeExecutionStatus(); + + /** + * Model tests for TradeExecutionStatus + */ + @Test + public void testTradeExecutionStatus() { + // TODO: test TradeExecutionStatus + } + + /** + * Test the property 'symbol' + */ + @Test + public void symbolTest() { + // TODO: test symbol + } + + /** + * Test the property 'universalSymbol' + */ + @Test + public void universalSymbolTest() { + // TODO: test universalSymbol + } + + /** + * Test the property 'trade' + */ + @Test + public void tradeTest() { + // TODO: test trade + } + + /** + * Test the property 'state' + */ + @Test + public void stateTest() { + // TODO: test state + } + + /** + * Test the property 'filledUnits' + */ + @Test + public void filledUnitsTest() { + // TODO: test filledUnits + } + + /** + * Test the property 'action' + */ + @Test + public void actionTest() { + // TODO: test action + } + + /** + * Test the property 'price' + */ + @Test + public void priceTest() { + // TODO: test price + } + + /** + * Test the property 'commissions' + */ + @Test + public void commissionsTest() { + // TODO: test commissions + } + + /** + * Test the property 'meta' + */ + @Test + public void metaTest() { + // TODO: test meta + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/TradeImpactTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/TradeImpactTest.java new file mode 100644 index 0000000000..5d6dbbabbb --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/TradeImpactTest.java @@ -0,0 +1,83 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.Account; +import com.konfigthis.client.model.Currency; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for TradeImpact + */ +public class TradeImpactTest { + private final TradeImpact model = new TradeImpact(); + + /** + * Model tests for TradeImpact + */ + @Test + public void testTradeImpact() { + // TODO: test TradeImpact + } + + /** + * Test the property 'account' + */ + @Test + public void accountTest() { + // TODO: test account + } + + /** + * Test the property 'currency' + */ + @Test + public void currencyTest() { + // TODO: test currency + } + + /** + * Test the property 'remainingCash' + */ + @Test + public void remainingCashTest() { + // TODO: test remainingCash + } + + /** + * Test the property 'estimatedCommissions' + */ + @Test + public void estimatedCommissionsTest() { + // TODO: test estimatedCommissions + } + + /** + * Test the property 'forexFees' + */ + @Test + public void forexFeesTest() { + // TODO: test forexFees + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/TradeTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/TradeTest.java new file mode 100644 index 0000000000..babf94b459 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/TradeTest.java @@ -0,0 +1,109 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.Account; +import com.konfigthis.client.model.BrokerageSymbol; +import com.konfigthis.client.model.UniversalSymbol; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for Trade + */ +public class TradeTest { + private final Trade model = new Trade(); + + /** + * Model tests for Trade + */ + @Test + public void testTrade() { + // TODO: test Trade + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'account' + */ + @Test + public void accountTest() { + // TODO: test account + } + + /** + * Test the property 'symbol' + */ + @Test + public void symbolTest() { + // TODO: test symbol + } + + /** + * Test the property 'universalSymbol' + */ + @Test + public void universalSymbolTest() { + // TODO: test universalSymbol + } + + /** + * Test the property 'action' + */ + @Test + public void actionTest() { + // TODO: test action + } + + /** + * Test the property 'units' + */ + @Test + public void unitsTest() { + // TODO: test units + } + + /** + * Test the property 'price' + */ + @Test + public void priceTest() { + // TODO: test price + } + + /** + * Test the property 'sequence' + */ + @Test + public void sequenceTest() { + // TODO: test sequence + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/TradingCancelUserAccountOrderRequestTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/TradingCancelUserAccountOrderRequestTest.java new file mode 100644 index 0000000000..bf60fc2b28 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/TradingCancelUserAccountOrderRequestTest.java @@ -0,0 +1,50 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for TradingCancelUserAccountOrderRequest + */ +public class TradingCancelUserAccountOrderRequestTest { + private final TradingCancelUserAccountOrderRequest model = new TradingCancelUserAccountOrderRequest(); + + /** + * Model tests for TradingCancelUserAccountOrderRequest + */ + @Test + public void testTradingCancelUserAccountOrderRequest() { + // TODO: test TradingCancelUserAccountOrderRequest + } + + /** + * Test the property 'brokerageOrderId' + */ + @Test + public void brokerageOrderIdTest() { + // TODO: test brokerageOrderId + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/TransactionsStatusTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/TransactionsStatusTest.java new file mode 100644 index 0000000000..01c97f87be --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/TransactionsStatusTest.java @@ -0,0 +1,67 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.time.LocalDate; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for TransactionsStatus + */ +public class TransactionsStatusTest { + private final TransactionsStatus model = new TransactionsStatus(); + + /** + * Model tests for TransactionsStatus + */ + @Test + public void testTransactionsStatus() { + // TODO: test TransactionsStatus + } + + /** + * Test the property 'initialSyncCompleted' + */ + @Test + public void initialSyncCompletedTest() { + // TODO: test initialSyncCompleted + } + + /** + * Test the property 'lastSuccessfulSync' + */ + @Test + public void lastSuccessfulSyncTest() { + // TODO: test lastSuccessfulSync + } + + /** + * Test the property 'firstTransactionDate' + */ + @Test + public void firstTransactionDateTest() { + // TODO: test firstTransactionDate + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/USExchangeTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/USExchangeTest.java new file mode 100644 index 0000000000..4e54871f2e --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/USExchangeTest.java @@ -0,0 +1,115 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for USExchange + */ +public class USExchangeTest { + private final USExchange model = new USExchange(); + + /** + * Model tests for USExchange + */ + @Test + public void testUSExchange() { + // TODO: test USExchange + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'code' + */ + @Test + public void codeTest() { + // TODO: test code + } + + /** + * Test the property 'micCode' + */ + @Test + public void micCodeTest() { + // TODO: test micCode + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'timezone' + */ + @Test + public void timezoneTest() { + // TODO: test timezone + } + + /** + * Test the property 'startTime' + */ + @Test + public void startTimeTest() { + // TODO: test startTime + } + + /** + * Test the property 'closeTime' + */ + @Test + public void closeTimeTest() { + // TODO: test closeTime + } + + /** + * Test the property 'suffix' + */ + @Test + public void suffixTest() { + // TODO: test suffix + } + + /** + * Test the property 'allowsCryptocurrencySymbols' + */ + @Test + public void allowsCryptocurrencySymbolsTest() { + // TODO: test allowsCryptocurrencySymbols + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/UnderlyingSymbolTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/UnderlyingSymbolTest.java new file mode 100644 index 0000000000..cd9652369f --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/UnderlyingSymbolTest.java @@ -0,0 +1,121 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.Currency; +import com.konfigthis.client.model.FigiInstrumentNullable; +import com.konfigthis.client.model.SecurityType; +import com.konfigthis.client.model.USExchange; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for UnderlyingSymbol + */ +public class UnderlyingSymbolTest { + private final UnderlyingSymbol model = new UnderlyingSymbol(); + + /** + * Model tests for UnderlyingSymbol + */ + @Test + public void testUnderlyingSymbol() { + // TODO: test UnderlyingSymbol + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'symbol' + */ + @Test + public void symbolTest() { + // TODO: test symbol + } + + /** + * Test the property 'description' + */ + @Test + public void descriptionTest() { + // TODO: test description + } + + /** + * Test the property 'currency' + */ + @Test + public void currencyTest() { + // TODO: test currency + } + + /** + * Test the property 'exchange' + */ + @Test + public void exchangeTest() { + // TODO: test exchange + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'currencies' + */ + @Test + public void currenciesTest() { + // TODO: test currencies + } + + /** + * Test the property 'figiCode' + */ + @Test + public void figiCodeTest() { + // TODO: test figiCode + } + + /** + * Test the property 'figiInstrument' + */ + @Test + public void figiInstrumentTest() { + // TODO: test figiInstrument + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/UniversalActivityTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/UniversalActivityTest.java new file mode 100644 index 0000000000..371a7762b4 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/UniversalActivityTest.java @@ -0,0 +1,182 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.AccountSimple; +import com.konfigthis.client.model.Currency; +import com.konfigthis.client.model.OptionsSymbol; +import com.konfigthis.client.model.Symbol; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for UniversalActivity + */ +public class UniversalActivityTest { + private final UniversalActivity model = new UniversalActivity(); + + /** + * Model tests for UniversalActivity + */ + @Test + public void testUniversalActivity() { + // TODO: test UniversalActivity + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'account' + */ + @Test + public void accountTest() { + // TODO: test account + } + + /** + * Test the property 'amount' + */ + @Test + public void amountTest() { + // TODO: test amount + } + + /** + * Test the property 'currency' + */ + @Test + public void currencyTest() { + // TODO: test currency + } + + /** + * Test the property 'description' + */ + @Test + public void descriptionTest() { + // TODO: test description + } + + /** + * Test the property 'fee' + */ + @Test + public void feeTest() { + // TODO: test fee + } + + /** + * Test the property 'fxRate' + */ + @Test + public void fxRateTest() { + // TODO: test fxRate + } + + /** + * Test the property 'institution' + */ + @Test + public void institutionTest() { + // TODO: test institution + } + + /** + * Test the property 'optionType' + */ + @Test + public void optionTypeTest() { + // TODO: test optionType + } + + /** + * Test the property 'price' + */ + @Test + public void priceTest() { + // TODO: test price + } + + /** + * Test the property 'settlementDate' + */ + @Test + public void settlementDateTest() { + // TODO: test settlementDate + } + + /** + * Test the property 'externalReferenceId' + */ + @Test + public void externalReferenceIdTest() { + // TODO: test externalReferenceId + } + + /** + * Test the property 'symbol' + */ + @Test + public void symbolTest() { + // TODO: test symbol + } + + /** + * Test the property 'optionSymbol' + */ + @Test + public void optionSymbolTest() { + // TODO: test optionSymbol + } + + /** + * Test the property 'tradeDate' + */ + @Test + public void tradeDateTest() { + // TODO: test tradeDate + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'units' + */ + @Test + public void unitsTest() { + // TODO: test units + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/UniversalSymbolNullableTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/UniversalSymbolNullableTest.java new file mode 100644 index 0000000000..31284af438 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/UniversalSymbolNullableTest.java @@ -0,0 +1,129 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.Currency; +import com.konfigthis.client.model.Exchange; +import com.konfigthis.client.model.FigiInstrumentNullable; +import com.konfigthis.client.model.SecurityType; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for UniversalSymbolNullable + */ +public class UniversalSymbolNullableTest { + private final UniversalSymbolNullable model = new UniversalSymbolNullable(); + + /** + * Model tests for UniversalSymbolNullable + */ + @Test + public void testUniversalSymbolNullable() { + // TODO: test UniversalSymbolNullable + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'symbol' + */ + @Test + public void symbolTest() { + // TODO: test symbol + } + + /** + * Test the property 'rawSymbol' + */ + @Test + public void rawSymbolTest() { + // TODO: test rawSymbol + } + + /** + * Test the property 'description' + */ + @Test + public void descriptionTest() { + // TODO: test description + } + + /** + * Test the property 'currency' + */ + @Test + public void currencyTest() { + // TODO: test currency + } + + /** + * Test the property 'exchange' + */ + @Test + public void exchangeTest() { + // TODO: test exchange + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'currencies' + */ + @Test + public void currenciesTest() { + // TODO: test currencies + } + + /** + * Test the property 'figiCode' + */ + @Test + public void figiCodeTest() { + // TODO: test figiCode + } + + /** + * Test the property 'figiInstrument' + */ + @Test + public void figiInstrumentTest() { + // TODO: test figiInstrument + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/UniversalSymbolTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/UniversalSymbolTest.java new file mode 100644 index 0000000000..014e0aa3cd --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/UniversalSymbolTest.java @@ -0,0 +1,129 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.Currency; +import com.konfigthis.client.model.Exchange; +import com.konfigthis.client.model.FigiInstrumentNullable; +import com.konfigthis.client.model.SecurityType; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for UniversalSymbol + */ +public class UniversalSymbolTest { + private final UniversalSymbol model = new UniversalSymbol(); + + /** + * Model tests for UniversalSymbol + */ + @Test + public void testUniversalSymbol() { + // TODO: test UniversalSymbol + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'symbol' + */ + @Test + public void symbolTest() { + // TODO: test symbol + } + + /** + * Test the property 'rawSymbol' + */ + @Test + public void rawSymbolTest() { + // TODO: test rawSymbol + } + + /** + * Test the property 'description' + */ + @Test + public void descriptionTest() { + // TODO: test description + } + + /** + * Test the property 'currency' + */ + @Test + public void currencyTest() { + // TODO: test currency + } + + /** + * Test the property 'exchange' + */ + @Test + public void exchangeTest() { + // TODO: test exchange + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'currencies' + */ + @Test + public void currenciesTest() { + // TODO: test currencies + } + + /** + * Test the property 'figiCode' + */ + @Test + public void figiCodeTest() { + // TODO: test figiCode + } + + /** + * Test the property 'figiInstrument' + */ + @Test + public void figiInstrumentTest() { + // TODO: test figiInstrument + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/UserErrorLogTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/UserErrorLogTest.java new file mode 100644 index 0000000000..b87d5ee62d --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/UserErrorLogTest.java @@ -0,0 +1,89 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for UserErrorLog + */ +public class UserErrorLogTest { + private final UserErrorLog model = new UserErrorLog(); + + /** + * Model tests for UserErrorLog + */ + @Test + public void testUserErrorLog() { + // TODO: test UserErrorLog + } + + /** + * Test the property 'requestedAt' + */ + @Test + public void requestedAtTest() { + // TODO: test requestedAt + } + + /** + * Test the property 'response' + */ + @Test + public void responseTest() { + // TODO: test response + } + + /** + * Test the property 'statusCode' + */ + @Test + public void statusCodeTest() { + // TODO: test statusCode + } + + /** + * Test the property 'queryParams' + */ + @Test + public void queryParamsTest() { + // TODO: test queryParams + } + + /** + * Test the property 'httpMethod' + */ + @Test + public void httpMethodTest() { + // TODO: test httpMethod + } + + /** + * Test the property 'endpoint' + */ + @Test + public void endpointTest() { + // TODO: test endpoint + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/UserIDandSecretTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/UserIDandSecretTest.java new file mode 100644 index 0000000000..dc8a51c4bc --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/UserIDandSecretTest.java @@ -0,0 +1,57 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for UserIDandSecret + */ +public class UserIDandSecretTest { + private final UserIDandSecret model = new UserIDandSecret(); + + /** + * Model tests for UserIDandSecret + */ + @Test + public void testUserIDandSecret() { + // TODO: test UserIDandSecret + } + + /** + * Test the property 'userId' + */ + @Test + public void userIdTest() { + // TODO: test userId + } + + /** + * Test the property 'userSecret' + */ + @Test + public void userSecretTest() { + // TODO: test userSecret + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/UserSettingsTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/UserSettingsTest.java new file mode 100644 index 0000000000..bfae3c893f --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/UserSettingsTest.java @@ -0,0 +1,122 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.konfigthis.client.model.Currency; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for UserSettings + */ +public class UserSettingsTest { + private final UserSettings model = new UserSettings(); + + /** + * Model tests for UserSettings + */ + @Test + public void testUserSettings() { + // TODO: test UserSettings + } + + /** + * Test the property 'email' + */ + @Test + public void emailTest() { + // TODO: test email + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'receiveCashNotification' + */ + @Test + public void receiveCashNotificationTest() { + // TODO: test receiveCashNotification + } + + /** + * Test the property 'receiveDriftNotification' + */ + @Test + public void receiveDriftNotificationTest() { + // TODO: test receiveDriftNotification + } + + /** + * Test the property 'userTrialActivated' + */ + @Test + public void userTrialActivatedTest() { + // TODO: test userTrialActivated + } + + /** + * Test the property 'activatedTrialDate' + */ + @Test + public void activatedTrialDateTest() { + // TODO: test activatedTrialDate + } + + /** + * Test the property 'demo' + */ + @Test + public void demoTest() { + // TODO: test demo + } + + /** + * Test the property 'apiEnabled' + */ + @Test + public void apiEnabledTest() { + // TODO: test apiEnabled + } + + /** + * Test the property 'driftThreshold' + */ + @Test + public void driftThresholdTest() { + // TODO: test driftThreshold + } + + /** + * Test the property 'preferredCurrency' + */ + @Test + public void preferredCurrencyTest() { + // TODO: test preferredCurrency + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ValidatedTradeBodyTest.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ValidatedTradeBodyTest.java new file mode 100644 index 0000000000..2ee43def97 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/sdks/java/src/test/java/com/konfigthis/client/model/ValidatedTradeBodyTest.java @@ -0,0 +1,50 @@ +/* + * SnapTrade + * Connect brokerage accounts to your app for live positions and trading + * + * The version of the OpenAPI document: 1.0.0 + * Contact: api@snaptrade.com + * + * NOTE: This class is auto generated by Konfig (https://konfigthis.com). + * Do not edit the class manually. + */ + + +package com.konfigthis.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for ValidatedTradeBody + */ +public class ValidatedTradeBodyTest { + private final ValidatedTradeBody model = new ValidatedTradeBody(); + + /** + * Model tests for ValidatedTradeBody + */ + @Test + public void testValidatedTradeBody() { + // TODO: test ValidatedTradeBody + } + + /** + * Test the property 'waitToConfirm' + */ + @Test + public void waitToConfirmTest() { + // TODO: test waitToConfirm + } + +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/snippets/java.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/snippets/java.java new file mode 100644 index 0000000000..02136bae36 --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/snippets/java.java @@ -0,0 +1,69 @@ +import com.konfigthis.client.ApiException; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.model.*; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + + public static void main(String[] args) { + // 1) Initialize default client with clientID and consumerKey + Configuration configuration = new Configuration(); + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + Snaptrade snaptrade = new Snaptrade(configuration); + + // 2) Check that the client is able to make a request to the API server + Status status = snaptrade.apiStatus.check().execute(); + System.out.printf("SnapTrade is online: %s\n", status.getOnline()); + + // 3) Create a new user on SnapTrade + // The userId should be provided by you and refer to permanent value such as a + // database row ID + UUID userId = UUID.randomUUID(); + UserIDandSecret userIDandSecret = snaptrade.authentication.registerSnapTradeUser() + .userId(userId.toString()).execute(); + + new SnapTradeRegisterUserRequestBody().userId(userId.toString()); + // Note: A user secret is only generated once. It's required to access resources + // for certain endpoints + System.out.printf("userID: %s, userSecret: %s\n", userIDandSecret.getUserId(), + userIDandSecret.getUserSecret()); + + // 4) Get a redirect URI. Users will need this to connect their brokerage to the + // SnapTrade server + Map response = (Map) snaptrade.authentication + .loginSnapTradeUser(userIDandSecret.getUserId(), + userIDandSecret.getUserSecret()) + .execute(); + System.out.println(response.get("redirectURI")); + + // 5) Make a portfolio group and query + List portfolioGroupsFromPost = snaptrade.portfolioManagement.create( + userIDandSecret.getUserId(), userIDandSecret.getUserSecret()).id(UUID.randomUUID()) + .name("MyPortfolio").execute(); + System.out.println(portfolioGroupsFromPost); + List portfolioGroups = snaptrade.portfolioManagement.list(userIDandSecret.getUserId(), + userIDandSecret.getUserSecret()).execute(); + System.out.println(portfolioGroups); + + // 7) Query holdings and available brokerages + List holdings = snaptrade.accountInformation + .getAllUserHoldings(userIDandSecret.getUserId(), + userIDandSecret.getUserSecret()) + .execute(); + System.out.println(holdings); + List accounts = snaptrade.accountInformation.listUserAccounts(userIDandSecret.getUserId(), + userIDandSecret.getUserSecret()).execute(); + System.out.println(accounts); + List brokerages = snaptrade.referenceData.listAllBrokerages().execute(); + System.out.println(brokerages); + + // 8) Deleting a user + DeleteUserResponse deleteUserResponse = snaptrade.authentication + .deleteSnapTradeUser(userIDandSecret.getUserId()).execute(); + System.out.println(deleteUserResponse); + } +} diff --git a/generator/konfig-integration-tests/sdks/java-additional-null-property/snippets/javaDocAuthPartial.java b/generator/konfig-integration-tests/sdks/java-additional-null-property/snippets/javaDocAuthPartial.java new file mode 100644 index 0000000000..9cbfdd083e --- /dev/null +++ b/generator/konfig-integration-tests/sdks/java-additional-null-property/snippets/javaDocAuthPartial.java @@ -0,0 +1,2 @@ +configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); +configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); diff --git a/generator/konfig-integration-tests/tests/__snapshots__/java-additional-null-property.test.ts.snap b/generator/konfig-integration-tests/tests/__snapshots__/java-additional-null-property.test.ts.snap new file mode 100644 index 0000000000..0bb6c282c6 --- /dev/null +++ b/generator/konfig-integration-tests/tests/__snapshots__/java-additional-null-property.test.ts.snap @@ -0,0 +1,356 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`java-additional-null-property 1`] = ` +"
+ +[![Visit SnapTrade](https://raw.githubusercontent.com/passiv/snaptrade-sdks/HEAD/sdks/java/header.png)](https://snaptrade.com) + +# [SnapTrade](https://snaptrade.com) + +Connect brokerage accounts to your app for live positions and trading + +[![Maven Central](https://img.shields.io/badge/Maven%20Central-v5.0.30-blue)](https://central.sonatype.com/artifact/com.konfigthis/snaptrade-java-sdk/5.0.30) +[![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/) + +
+ +## Requirements + +Building the API client library requires: + +1. Java 1.8+ +2. Maven (3.8.3+)/Gradle (7.2+) + +If you are adding this library to an Android Application or Library: + +3. Android 8.0+ (API Level 26+) + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +\`\`\`shell +mvn clean install +\`\`\` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +\`\`\`shell +mvn clean deploy +\`\`\` + +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +\`\`\`xml + + com.konfigthis + snaptrade-java-sdk + 5.0.30 + compile + +\`\`\` + +### Gradle users + +Add this dependency to your \`build.gradle\`: + +\`\`\`groovy +// build.gradle +repositories { + mavenCentral() +} + +dependencies { + implementation "com.konfigthis:snaptrade-java-sdk:5.0.30" +} +\`\`\` + +### Android users + +Make sure your \`build.gradle\` file as a \`minSdk\` version of at least 26: +\`\`\`groovy +// build.gradle +android { + defaultConfig { + minSdk 26 + } +} +\`\`\` + +Also make sure your library or application has internet permissions in your \`AndroidManifest.xml\`: + +\`\`\`xml + + + + + +\`\`\` + +### Others + +At first generate the JAR by executing: + +\`\`\`shell +mvn clean package +\`\`\` + +Then manually install the following JARs: + +* \`target/snaptrade-java-sdk-5.0.30.jar\` +* \`target/lib/*.jar\` + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +\`\`\`java +import com.konfigthis.client.ApiException; +import com.konfigthis.client.Configuration; +import com.konfigthis.client.Snaptrade; +import com.konfigthis.client.model.*; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class Example { + + public static void main(String[] args) { + // 1) Initialize default client with clientID and consumerKey + Configuration configuration = new Configuration(); + configuration.clientId = System.getenv("SNAPTRADE_CLIENT_ID"); + configuration.consumerKey = System.getenv("SNAPTRADE_CONSUMER_KEY"); + Snaptrade snaptrade = new Snaptrade(configuration); + + // 2) Check that the client is able to make a request to the API server + Status status = snaptrade.apiStatus.check().execute(); + System.out.printf("SnapTrade is online: %s\\n", status.getOnline()); + + // 3) Create a new user on SnapTrade + // The userId should be provided by you and refer to permanent value such as a + // database row ID + UUID userId = UUID.randomUUID(); + UserIDandSecret userIDandSecret = snaptrade.authentication.registerSnapTradeUser() + .userId(userId.toString()).execute(); + + new SnapTradeRegisterUserRequestBody().userId(userId.toString()); + // Note: A user secret is only generated once. It's required to access resources + // for certain endpoints + System.out.printf("userID: %s, userSecret: %s\\n", userIDandSecret.getUserId(), + userIDandSecret.getUserSecret()); + + // 4) Get a redirect URI. Users will need this to connect their brokerage to the + // SnapTrade server + Map response = (Map) snaptrade.authentication + .loginSnapTradeUser(userIDandSecret.getUserId(), + userIDandSecret.getUserSecret()) + .execute(); + System.out.println(response.get("redirectURI")); + + // 5) Make a portfolio group and query + List portfolioGroupsFromPost = snaptrade.portfolioManagement.create( + userIDandSecret.getUserId(), userIDandSecret.getUserSecret()).id(UUID.randomUUID()) + .name("MyPortfolio").execute(); + System.out.println(portfolioGroupsFromPost); + List portfolioGroups = snaptrade.portfolioManagement.list(userIDandSecret.getUserId(), + userIDandSecret.getUserSecret()).execute(); + System.out.println(portfolioGroups); + + // 7) Query holdings and available brokerages + List holdings = snaptrade.accountInformation + .getAllUserHoldings(userIDandSecret.getUserId(), + userIDandSecret.getUserSecret()) + .execute(); + System.out.println(holdings); + List accounts = snaptrade.accountInformation.listUserAccounts(userIDandSecret.getUserId(), + userIDandSecret.getUserSecret()).execute(); + System.out.println(accounts); + List brokerages = snaptrade.referenceData.listAllBrokerages().execute(); + System.out.println(brokerages); + + // 8) Deleting a user + DeleteUserResponse deleteUserResponse = snaptrade.authentication + .deleteSnapTradeUser(userIDandSecret.getUserId()).execute(); + System.out.println(deleteUserResponse); + } +} + +\`\`\` + +## Documentation for API Endpoints + +All URIs are relative to *https://api.snaptrade.com/api/v1* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AccountInformationApi* | [**getAllUserHoldings**](docs/AccountInformationApi.md#getAllUserHoldings) | **GET** /holdings | List all accounts for the user, plus balances, positions, and orders for each account. +*AccountInformationApi* | [**getUserAccountBalance**](docs/AccountInformationApi.md#getUserAccountBalance) | **GET** /accounts/{accountId}/balances | List account balances +*AccountInformationApi* | [**getUserAccountDetails**](docs/AccountInformationApi.md#getUserAccountDetails) | **GET** /accounts/{accountId} | Return details of a specific investment account +*AccountInformationApi* | [**getUserAccountOrders**](docs/AccountInformationApi.md#getUserAccountOrders) | **GET** /accounts/{accountId}/orders | List account orders +*AccountInformationApi* | [**getUserAccountPositions**](docs/AccountInformationApi.md#getUserAccountPositions) | **GET** /accounts/{accountId}/positions | List account positions +*AccountInformationApi* | [**getUserHoldings**](docs/AccountInformationApi.md#getUserHoldings) | **GET** /accounts/{accountId}/holdings | List account holdings +*AccountInformationApi* | [**listUserAccounts**](docs/AccountInformationApi.md#listUserAccounts) | **GET** /accounts | List accounts +*AccountInformationApi* | [**updateUserAccount**](docs/AccountInformationApi.md#updateUserAccount) | **PUT** /accounts/{accountId} | Update details of an investment account +*ApiStatusApi* | [**check**](docs/ApiStatusApi.md#check) | **GET** / | Get API Status +*AuthenticationApi* | [**deleteSnapTradeUser**](docs/AuthenticationApi.md#deleteSnapTradeUser) | **DELETE** /snapTrade/deleteUser | Delete SnapTrade user +*AuthenticationApi* | [**listSnapTradeUsers**](docs/AuthenticationApi.md#listSnapTradeUsers) | **GET** /snapTrade/listUsers | List SnapTrade users +*AuthenticationApi* | [**loginSnapTradeUser**](docs/AuthenticationApi.md#loginSnapTradeUser) | **POST** /snapTrade/login | Login user & generate connection link +*AuthenticationApi* | [**registerSnapTradeUser**](docs/AuthenticationApi.md#registerSnapTradeUser) | **POST** /snapTrade/registerUser | Create SnapTrade user +*AuthenticationApi* | [**resetSnapTradeUserSecret**](docs/AuthenticationApi.md#resetSnapTradeUserSecret) | **POST** /snapTrade/resetUserSecret | Obtain a new user secret for a user +*ConnectionsApi* | [**detailBrokerageAuthorization**](docs/ConnectionsApi.md#detailBrokerageAuthorization) | **GET** /authorizations/{authorizationId} | Get brokerage authorization details +*ConnectionsApi* | [**disableBrokerageAuthorization**](docs/ConnectionsApi.md#disableBrokerageAuthorization) | **POST** /authorizations/{authorizationId}/disable | Manually disable a connection for testing +*ConnectionsApi* | [**listBrokerageAuthorizations**](docs/ConnectionsApi.md#listBrokerageAuthorizations) | **GET** /authorizations | List all brokerage authorizations for the User +*ConnectionsApi* | [**refreshBrokerageAuthorization**](docs/ConnectionsApi.md#refreshBrokerageAuthorization) | **POST** /authorizations/{authorizationId}/refresh | Refresh holdings for a connection +*ConnectionsApi* | [**removeBrokerageAuthorization**](docs/ConnectionsApi.md#removeBrokerageAuthorization) | **DELETE** /authorizations/{authorizationId} | Delete brokerage authorization +*ConnectionsApi* | [**sessionEvents**](docs/ConnectionsApi.md#sessionEvents) | **GET** /sessionEvents | Get all session events for a user +*OptionsApi* | [**getOptionStrategy**](docs/OptionsApi.md#getOptionStrategy) | **POST** /accounts/{accountId}/optionStrategy | Create options strategy +*OptionsApi* | [**getOptionsChain**](docs/OptionsApi.md#getOptionsChain) | **GET** /accounts/{accountId}/optionsChain | Get the options chain for a symbol +*OptionsApi* | [**getOptionsStrategyQuote**](docs/OptionsApi.md#getOptionsStrategyQuote) | **GET** /accounts/{accountId}/optionStrategy/{optionStrategyId} | Get options strategy quotes +*OptionsApi* | [**listOptionHoldings**](docs/OptionsApi.md#listOptionHoldings) | **GET** /accounts/{accountId}/options | Get account option holdings +*OptionsApi* | [**placeOptionStrategy**](docs/OptionsApi.md#placeOptionStrategy) | **POST** /accounts/{accountId}/optionStrategy/{optionStrategyId}/execute | Place an option strategy order +*ReferenceDataApi* | [**getCurrencyExchangeRatePair**](docs/ReferenceDataApi.md#getCurrencyExchangeRatePair) | **GET** /currencies/rates/{currencyPair} | Get exchange rate of a currency pair +*ReferenceDataApi* | [**getPartnerInfo**](docs/ReferenceDataApi.md#getPartnerInfo) | **GET** /snapTrade/partners | Get metadata related to Snaptrade partner +*ReferenceDataApi* | [**getSecurityTypes**](docs/ReferenceDataApi.md#getSecurityTypes) | **GET** /securityTypes | List of all security types +*ReferenceDataApi* | [**getStockExchanges**](docs/ReferenceDataApi.md#getStockExchanges) | **GET** /exchanges | Get exchanges +*ReferenceDataApi* | [**getSymbols**](docs/ReferenceDataApi.md#getSymbols) | **POST** /symbols | Search for symbols +*ReferenceDataApi* | [**getSymbolsByTicker**](docs/ReferenceDataApi.md#getSymbolsByTicker) | **GET** /symbols/{query} | Get details of a symbol +*ReferenceDataApi* | [**listAllBrokerageAuthorizationType**](docs/ReferenceDataApi.md#listAllBrokerageAuthorizationType) | **GET** /brokerageAuthorizationTypes | Get all brokerage authorization types +*ReferenceDataApi* | [**listAllBrokerages**](docs/ReferenceDataApi.md#listAllBrokerages) | **GET** /brokerages | Get brokerages +*ReferenceDataApi* | [**listAllCurrencies**](docs/ReferenceDataApi.md#listAllCurrencies) | **GET** /currencies | Get currencies +*ReferenceDataApi* | [**listAllCurrenciesRates**](docs/ReferenceDataApi.md#listAllCurrenciesRates) | **GET** /currencies/rates | Get currency exchange rates +*ReferenceDataApi* | [**symbolSearchUserAccount**](docs/ReferenceDataApi.md#symbolSearchUserAccount) | **POST** /accounts/{accountId}/symbols | Search for symbols available in an account +*TradingApi* | [**cancelUserAccountOrder**](docs/TradingApi.md#cancelUserAccountOrder) | **POST** /accounts/{accountId}/orders/cancel | Cancel open order in account +*TradingApi* | [**getOrderImpact**](docs/TradingApi.md#getOrderImpact) | **POST** /trade/impact | Check the impact of a trade on an account +*TradingApi* | [**getUserAccountQuotes**](docs/TradingApi.md#getUserAccountQuotes) | **GET** /accounts/{accountId}/quotes | Get symbol quotes +*TradingApi* | [**placeForceOrder**](docs/TradingApi.md#placeForceOrder) | **POST** /trade/place | Place a trade with NO validation. +*TradingApi* | [**placeOrder**](docs/TradingApi.md#placeOrder) | **POST** /trade/{tradeId} | Place order +*TransactionsAndReportingApi* | [**getActivities**](docs/TransactionsAndReportingApi.md#getActivities) | **GET** /activities | Get transaction history for a user +*TransactionsAndReportingApi* | [**getReportingCustomRange**](docs/TransactionsAndReportingApi.md#getReportingCustomRange) | **GET** /performance/custom | Get performance information for a specific timeframe + + +## Documentation for Models + + - [Account](docs/Account.md) + - [AccountBalance](docs/AccountBalance.md) + - [AccountBalanceNullable](docs/AccountBalanceNullable.md) + - [AccountHoldings](docs/AccountHoldings.md) + - [AccountHoldingsAccount](docs/AccountHoldingsAccount.md) + - [AccountOrderRecord](docs/AccountOrderRecord.md) + - [AccountOrderRecordStatus](docs/AccountOrderRecordStatus.md) + - [AccountSimple](docs/AccountSimple.md) + - [AccountSyncStatus](docs/AccountSyncStatus.md) + - [ActionStrict](docs/ActionStrict.md) + - [Amount](docs/Amount.md) + - [AmountNullable](docs/AmountNullable.md) + - [Balance](docs/Balance.md) + - [Brokerage](docs/Brokerage.md) + - [BrokerageAuthorization](docs/BrokerageAuthorization.md) + - [BrokerageAuthorizationDisabledConfirmation](docs/BrokerageAuthorizationDisabledConfirmation.md) + - [BrokerageAuthorizationRefreshConfirmation](docs/BrokerageAuthorizationRefreshConfirmation.md) + - [BrokerageAuthorizationType](docs/BrokerageAuthorizationType.md) + - [BrokerageAuthorizationTypeReadOnly](docs/BrokerageAuthorizationTypeReadOnly.md) + - [BrokerageAuthorizationTypeReadOnlyBrokerage](docs/BrokerageAuthorizationTypeReadOnlyBrokerage.md) + - [BrokerageSymbol](docs/BrokerageSymbol.md) + - [BrokerageType](docs/BrokerageType.md) + - [CalculatedTrade](docs/CalculatedTrade.md) + - [CashRestriction](docs/CashRestriction.md) + - [Currency](docs/Currency.md) + - [CurrencyNullable](docs/CurrencyNullable.md) + - [DeleteUserResponse](docs/DeleteUserResponse.md) + - [DividendAtDate](docs/DividendAtDate.md) + - [EncryptedResponse](docs/EncryptedResponse.md) + - [EncryptedResponseEncryptedMessageData](docs/EncryptedResponseEncryptedMessageData.md) + - [Exchange](docs/Exchange.md) + - [ExchangeRatePairs](docs/ExchangeRatePairs.md) + - [ExcludedAsset](docs/ExcludedAsset.md) + - [FigiInstrument](docs/FigiInstrument.md) + - [FigiInstrumentNullable](docs/FigiInstrumentNullable.md) + - [HoldingsStatus](docs/HoldingsStatus.md) + - [JWT](docs/JWT.md) + - [LoginRedirectURI](docs/LoginRedirectURI.md) + - [ManualTrade](docs/ManualTrade.md) + - [ManualTradeAndImpact](docs/ManualTradeAndImpact.md) + - [ManualTradeBalance](docs/ManualTradeBalance.md) + - [ManualTradeForm](docs/ManualTradeForm.md) + - [ManualTradeSymbol](docs/ManualTradeSymbol.md) + - [ModelAssetClass](docs/ModelAssetClass.md) + - [ModelAssetClassDetails](docs/ModelAssetClassDetails.md) + - [ModelAssetClassTarget](docs/ModelAssetClassTarget.md) + - [ModelPortfolio](docs/ModelPortfolio.md) + - [ModelPortfolioAssetClass](docs/ModelPortfolioAssetClass.md) + - [ModelPortfolioDetails](docs/ModelPortfolioDetails.md) + - [ModelPortfolioSecurity](docs/ModelPortfolioSecurity.md) + - [MonthlyDividends](docs/MonthlyDividends.md) + - [NetContributions](docs/NetContributions.md) + - [NetDividend](docs/NetDividend.md) + - [OptionBrokerageSymbol](docs/OptionBrokerageSymbol.md) + - [OptionChainInner](docs/OptionChainInner.md) + - [OptionChainInnerChainPerRootInner](docs/OptionChainInnerChainPerRootInner.md) + - [OptionChainInnerChainPerRootInnerChainPerStrikePriceInner](docs/OptionChainInnerChainPerRootInnerChainPerStrikePriceInner.md) + - [OptionLeg](docs/OptionLeg.md) + - [OptionStrategy](docs/OptionStrategy.md) + - [OptionStrategyLegsInner](docs/OptionStrategyLegsInner.md) + - [OptionsGetOptionStrategyRequest](docs/OptionsGetOptionStrategyRequest.md) + - [OptionsPlaceOptionStrategyRequest](docs/OptionsPlaceOptionStrategyRequest.md) + - [OptionsPosition](docs/OptionsPosition.md) + - [OptionsSymbol](docs/OptionsSymbol.md) + - [OptionsSymbolNullable](docs/OptionsSymbolNullable.md) + - [OrderTypeStrict](docs/OrderTypeStrict.md) + - [PartnerData](docs/PartnerData.md) + - [PastValue](docs/PastValue.md) + - [PerformanceCustom](docs/PerformanceCustom.md) + - [PortfolioGroup](docs/PortfolioGroup.md) + - [PortfolioGroupInfo](docs/PortfolioGroupInfo.md) + - [PortfolioGroupPosition](docs/PortfolioGroupPosition.md) + - [PortfolioGroupSettings](docs/PortfolioGroupSettings.md) + - [Position](docs/Position.md) + - [PositionSymbol](docs/PositionSymbol.md) + - [RedirectTokenandPin](docs/RedirectTokenandPin.md) + - [SecurityType](docs/SecurityType.md) + - [SessionEvent](docs/SessionEvent.md) + - [SnapTradeAPIDisclaimerAcceptStatus](docs/SnapTradeAPIDisclaimerAcceptStatus.md) + - [SnapTradeHoldingsAccount](docs/SnapTradeHoldingsAccount.md) + - [SnapTradeHoldingsAccountAccountId](docs/SnapTradeHoldingsAccountAccountId.md) + - [SnapTradeHoldingsTotalValue](docs/SnapTradeHoldingsTotalValue.md) + - [SnapTradeLoginUserRequestBody](docs/SnapTradeLoginUserRequestBody.md) + - [SnapTradeRegisterUserRequestBody](docs/SnapTradeRegisterUserRequestBody.md) + - [Status](docs/Status.md) + - [StrategyImpact](docs/StrategyImpact.md) + - [StrategyImpactLegsInner](docs/StrategyImpactLegsInner.md) + - [StrategyOrderPlace](docs/StrategyOrderPlace.md) + - [StrategyOrderPlaceOrdersInner](docs/StrategyOrderPlaceOrdersInner.md) + - [StrategyOrderPlaceOrdersInnerLegsInner](docs/StrategyOrderPlaceOrdersInnerLegsInner.md) + - [StrategyOrderRecord](docs/StrategyOrderRecord.md) + - [StrategyQuotes](docs/StrategyQuotes.md) + - [StrategyQuotesGreek](docs/StrategyQuotesGreek.md) + - [SubPeriodReturnRate](docs/SubPeriodReturnRate.md) + - [Symbol](docs/Symbol.md) + - [SymbolQuery](docs/SymbolQuery.md) + - [SymbolsQuotesInner](docs/SymbolsQuotesInner.md) + - [TargetAsset](docs/TargetAsset.md) + - [TimeInForceStrict](docs/TimeInForceStrict.md) + - [Trade](docs/Trade.md) + - [TradeExecutionStatus](docs/TradeExecutionStatus.md) + - [TradeImpact](docs/TradeImpact.md) + - [TradingCancelUserAccountOrderRequest](docs/TradingCancelUserAccountOrderRequest.md) + - [TransactionsStatus](docs/TransactionsStatus.md) + - [USExchange](docs/USExchange.md) + - [UnderlyingSymbol](docs/UnderlyingSymbol.md) + - [UniversalActivity](docs/UniversalActivity.md) + - [UniversalSymbol](docs/UniversalSymbol.md) + - [UniversalSymbolNullable](docs/UniversalSymbolNullable.md) + - [UserErrorLog](docs/UserErrorLog.md) + - [UserIDandSecret](docs/UserIDandSecret.md) + - [UserSettings](docs/UserSettings.md) + - [ValidatedTradeBody](docs/ValidatedTradeBody.md) + + +## Author +This Java package is automatically generated by [Konfig](https://konfigthis.com) +" +`; diff --git a/generator/konfig-integration-tests/tests/java-additional-null-property.test.ts b/generator/konfig-integration-tests/tests/java-additional-null-property.test.ts new file mode 100644 index 0000000000..d424923a1b --- /dev/null +++ b/generator/konfig-integration-tests/tests/java-additional-null-property.test.ts @@ -0,0 +1,70 @@ +import { e2e } from "../util"; +import { test } from "vitest"; + +test("java-additional-null-property", async () => { + await e2e(4107, { + customServer: { + routes: [ + { + path: "/trade/impact", + method: "post", + response: { + trade: { + id: "dd78a663-359a-4d2f-9453-d88ba1e7ac13", + account: "c1c3436b-1c67-456a-b493-773dc9c4893f", + order_type: "Limit", + time_in_force: "GTC", + symbol: { + brokerage_symbol_id: "ed914d17-9e9d-40a7-9045-d6d24359d670", + universal_symbol_id: "3226ae9e-5f5d-46b3-ad51-a0b75ecd29e8", + currency: { + id: "57f81c53-bdda-45a7-a51f-032afd1ae41b", + code: "USD", + }, + description: "PayPal Holdings Inc", + local_id: "", + symbol: "PYPL", + }, + action: "BUY", + units: 3.0, + price: 60.0, + }, + trade_impacts: [ + { + account: "c1c3436b-1c67-456a-b493-773dc9c4893f", + currency: "57f81c53-bdda-45a7-a51f-032afd1ae41b", + remaining_cash: 61525.75, + estimated_commissions: 0.0, + forex_fees: 0.0, + }, + ], + combined_remaining_balance: { + account: { + id: "c1c3436b-1c67-456a-b493-773dc9c4893f", + number: "***123", + name: "Alpaca Margin", + sync_status: { + holdings: { + last_successful_sync: "2024-08-06 04:22:24.923643+00:00", + initial_sync_completed: true, + }, + transactions: { + last_successful_sync: "2024-08-05", + initial_sync_completed: true, + }, + }, + }, + currency: { + code: "USD", + name: "US Dollar", + id: "57f81c53-bdda-45a7-a51f-032afd1ae41b", + }, + cash: 61525.75, + buying_power: null, + }, + }, + }, + ], + }, + }); +});